ตั้งแต่วันที่ 27 มีนาคม 2025 เป็นต้นไป เราขอแนะนำให้ใช้ android-latest-release
แทน aosp-main
เพื่อสร้างและมีส่วนร่วมใน AOSP โปรดดูข้อมูลเพิ่มเติมที่หัวข้อการเปลี่ยนแปลงใน AOSP
แนวทางปฏิบัติแนะนำด้านความปลอดภัยของเครือข่าย
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ส่วนนี้มีคําแนะนําเพื่อรักษาความปลอดภัยของการสื่อสารผ่านเครือข่ายจากอุปกรณ์ Android
ซ็อกเก็ตการฟังที่ปลอดภัย
ใช้ซ็อกเก็ตการฟังอย่างระมัดระวัง โดยทั่วไปแล้ว ไม่ควรมีซ็อกเก็ตการฟังที่เปิดอยู่ในอุปกรณ์ เนื่องจากซ็อกเก็ตเหล่านี้เป็นเวกเตอร์ที่ช่วยให้ผู้โจมตีระยะไกลเข้าถึงอุปกรณ์ได้
- อุปกรณ์ Android ควรลดจำนวนซ็อกเก็ตการฟังอินเทอร์เน็ตที่แสดง โดยเฉพาะเมื่อบูตหรือโดยค่าเริ่มต้น โดยค่าเริ่มต้น ไม่ควรมีซ็อกเก็ตใดรับฟังในอินเทอร์เน็ตเมื่อบูต
- กระบวนการรูทและกระบวนการที่เป็นของตัวระบุที่ไม่ซ้ำกันของระบบ (UID) ไม่ควรแสดงซ็อกเก็ตการฟัง
- ซ็อกเก็ตการฟังต้องปิดใช้ได้โดยไม่ต้องอัปเดต OTA ซึ่งทำได้โดยใช้การเปลี่ยนแปลงการกำหนดค่าเซิร์ฟเวอร์หรืออุปกรณ์ของผู้ใช้
- สําหรับซ็อกเก็ตที่ใช้ IPC ในพื้นที่ แอปต้องใช้ซ็อกเก็ตโดเมน UNIX ที่มีการเข้าถึงจํากัดไว้สำหรับกลุ่ม สร้างตัวระบุไฟล์สำหรับ IPC และทำให้ไฟล์มีสิทธิ์ +RW สำหรับกลุ่ม UNIX ที่เฉพาะเจาะจง แอปไคลเอ็นต์ต้องอยู่ในกลุ่ม UNIX นั้น
- อุปกรณ์บางเครื่องที่มีตัวประมวลผลหลายตัว (เช่น วิทยุ/โมเด็มแยกต่างหากจากตัวประมวลผลแอป) ใช้ซ็อกเก็ตเครือข่ายเพื่อสื่อสารระหว่างตัวประมวลผล ในกรณีเช่นนี้ ซ็อกเก็ตเครือข่ายที่ใช้สำหรับการสื่อสารระหว่างโปรเซสเซอร์ต้องใช้อินเทอร์เฟซเครือข่ายที่แยกไว้เพื่อป้องกันการเข้าถึงโดยแอปที่ไม่ได้รับอนุญาตในอุปกรณ์ (เช่น ใช้ iptables เพื่อป้องกันไม่ให้แอปอื่นๆ ในอุปกรณ์เข้าถึง)
- เดมอนที่จัดการพอร์ตการฟังต้องมีความทนทานต่อข้อมูลที่ไม่เป็นรูปแบบ คุณควรทำการทดสอบแบบ Fuzz กับพอร์ตโดยใช้ไคลเอ็นต์ที่ไม่ได้รับอนุญาต และไคลเอ็นต์ที่ได้รับอนุญาต (หากเป็นไปได้) รายงานข้อบกพร่องเพื่อติดตามผลข้อขัดข้อง
ชุดเครื่องมือทดสอบความเข้ากันได้ของ Android (CTS) ประกอบด้วยการทดสอบที่ตรวจหาพอร์ตการฟังที่เปิดอยู่
ปิดใช้ ADB
Android Debug Bridge (adb) เป็นเครื่องมือสําคัญสําหรับการพัฒนาและการแก้ไขข้อบกพร่อง แต่ออกแบบมาเพื่อใช้ในสภาพแวดล้อมที่มีการควบคุมและปลอดภัย และไม่ควรเปิดใช้สําหรับการใช้งานทั่วไป
- ตรวจสอบว่า adb ถูกปิดใช้โดยค่าเริ่มต้น
- ตรวจสอบว่า adb กําหนดให้ผู้ใช้เปิดก่อนยอมรับการเชื่อมต่อ
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],null,["# Network security best practices\n\nThis section contains recommendations to ensure the security of network\ncommunications from Android devices.\n\nSecure listening sockets\n------------------------\n\nUse listening sockets with caution. There should generally\nnot be any open listening sockets on devices as these provide a vector for a\nremote attacker to gain access to the device.\n\n- Android devices should minimize the number of internet listening sockets they expose, especially on boot or by default. No socket should be listening on the internet at boot by default.\n - Root processes and processes owned by the system unique identifier (UID) shouldn't expose any listening sockets.\n- Listening sockets must be able to be disabled without an OTA update. This can be performed using either a server or user-device configuration change.\n- For local IPC-using sockets, apps must use a UNIX domain socket with access limited to a group. Create a file descriptor for the IPC and make it +RW for a specific UNIX group. Any client apps must be within that UNIX group.\n- Some devices with multiple processors (for example, a radio/modem separate from the app processor) use network sockets to communicate between processors. In such instances, the network socket used for inter-processor communication must use an isolated network interface to prevent access by unauthorized apps on the device (i.e. use iptables to prevent access by other apps on the device).\n- Daemons that handle listening ports must be robust against malformed data. You should conduct fuzz-testing against the port using an unauthorized client, and, where possible, authorized client. File bugs to follow up on crashes.\n\nThe [Android Compatibility Test Suite](/docs/core/tests)\n(CTS) includes tests that check for the presence of open listening ports.\n\n### Disable adb\n\nAndroid Debug Bridge (adb) is a valuable development and debugging tool, but\nis designed for use in a controlled, secure environment and shouldn't be\nenabled for general use.\n\n- Ensure that adb is disabled by default.\n- Ensure that adb requires the user to turn it on before accepting connections."]]