API หรือไลบรารีที่ไม่ปลอดภัย
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
หมวดหมู่ OWASP: MASVS-CODE: คุณภาพของโค้ด
ภาพรวม
การใช้ API หรือไลบรารีที่ไม่ปลอดภัยจะลดระดับความปลอดภัยของแอปพลิเคชันลงอย่างมาก
การละเมิดความปลอดภัยในทรัพยากร Dependency เหล่านี้จะทำให้ผู้โจมตี
ใช้ประโยชน์จากเวกเตอร์จำนวนมากเพื่อทำการโจมตีในวงกว้าง เช่น การโจมตีแบบแทรกกลางการสื่อสาร (MitM) และการเรียกใช้โค้ดจากระยะไกล (RCE)
ภัยคุกคามจากการใช้ทรัพยากร Dependency ที่ไม่ปลอดภัยจะเกิดขึ้นเมื่อนักพัฒนาซอฟต์แวร์ไม่
ผสานรวมการประเมินความปลอดภัยและการทดสอบช่องโหว่เข้ากับวงจรการพัฒนาซอฟต์แวร์ (SDLC) หรือในบางกรณีก็ไม่ได้ใช้นโยบายการอัปเดตอัตโนมัติ
สำหรับทรัพยากร Dependency ของแอปพลิเคชัน
การใช้ประโยชน์จาก Dependency มักเริ่มต้นด้วยการวิเคราะห์ไบนารีของแอปพลิเคชัน (.apk) เพื่อค้นหาไลบรารีที่มีช่องโหว่ ในขั้นตอนนี้จะมีการใช้ข่าวกรองจากแหล่งข้อมูลแบบเปิด (OSINT)
เพื่อค้นหาช่องโหว่ที่อาจถูกโจมตี
ซึ่งค้นพบก่อนหน้านี้ จากนั้นผู้โจมตีจะใช้ประโยชน์จากข้อมูลช่องโหว่ที่เปิดเผยต่อสาธารณะ
เช่น ช่องโหว่และการเปิดเผยที่พบบ่อย (CVE) เพื่อทำการโจมตีเพิ่มเติม
ผลกระทบ
การใช้ประโยชน์จากทรัพยากร Dependency ที่ไม่ปลอดภัยได้สำเร็จอาจนำไปสู่การโจมตีในวงกว้าง เช่น การเรียกใช้โค้ดจากระยะไกล (RCE), การแทรก SQL (SQLi) หรือ Cross-site Scripting (XSS)
ดังนั้น ผลกระทบโดยรวมจึงเกี่ยวข้องโดยตรงกับประเภทของช่องโหว่
ที่ซอฟต์แวร์ของบุคคลที่สามนำมาใช้และที่ผู้โจมตีสามารถใช้ประโยชน์ได้
ผลลัพธ์ที่เป็นไปได้ของการใช้ประโยชน์จากทรัพยากร Dependency ที่มีช่องโหว่
คือการละเมิดข้อมูลหรือบริการไม่พร้อมใช้งาน ซึ่งอาจส่งผลกระทบอย่างมาก
ต่อชื่อเสียงและรายได้ทางเศรษฐกิจ
การลดปัญหา
การป้องกันเชิงลึก
โปรดทราบว่าการลดความเสี่ยงที่ระบุไว้ด้านล่างต้องใช้ร่วมกันเพื่อ
ให้มั่นใจว่ามีท่าทีด้านความปลอดภัยที่แข็งแกร่งยิ่งขึ้น และลดพื้นผิวการโจมตีของแอปพลิเคชัน
คุณควรประเมินแนวทางที่แน่นอนเป็นกรณีๆ ไปเสมอ
การประเมินช่องโหว่ของการขึ้นต่อกัน
ใช้การยืนยันการขึ้นต่อกันตั้งแต่ช่วงต้นของวงจรการพัฒนา
เพื่อตรวจหาช่องโหว่ภายในโค้ดของบุคคลที่สาม ระยะนี้จะทดสอบว่าโค้ดที่ไม่ได้สร้างขึ้นภายในมีความปลอดภัยหรือไม่ก่อนที่จะเปิดตัวในสภาพแวดล้อมการทำงานจริง
การยืนยันอาจเสริมด้วยการใช้เครื่องมือทดสอบความปลอดภัยของแอปพลิเคชันแบบคงที่ (SAST) และเครื่องมือทดสอบความปลอดภัยของแอปพลิเคชันแบบไดนามิก (DAST) ภายในวงจรการพัฒนาซอฟต์แวร์เพื่อปรับปรุงระดับความปลอดภัยของแอปพลิเคชัน
อัปเดตทรัพยากร Dependency อย่างต่อเนื่อง
โปรดระมัดระวังในการอัปเดตการอ้างอิงที่ฝังอยู่ในโค้ดอย่างต่อเนื่องเสมอ ด้วยเหตุนี้ เราจึงขอแนะนำให้ใช้การอัปเดตอัตโนมัติที่จะ
พุชไปยังเวอร์ชันที่ใช้งานจริงทุกครั้งที่คอมโพเนนต์ของบุคคลที่สามเผยแพร่
แพตช์ความปลอดภัยใหม่
ทำการทดสอบการเจาะระบบเป็นประจำ การทดสอบประเภทนี้มีจุดมุ่งหมายเพื่อค้นหาช่องโหว่ที่รู้จักกันดีซึ่งอาจส่งผลต่อโค้ดที่เป็นกรรมสิทธิ์และ/หรือการขึ้นต่อกันของบุคคลที่สาม
นอกจากนี้ การประเมินการรักษาความปลอดภัยยังมักจะพบช่องโหว่ที่ไม่รู้จัก
(แบบ 0 วัน)
การทดสอบการเจาะระบบเป็นประโยชน์สำหรับนักพัฒนาแอป เนื่องจากจะช่วยให้เห็นภาพรวมของท่าทีด้านความปลอดภัยปัจจุบันของแอปพลิเคชัน และช่วยจัดลำดับความสำคัญของปัญหาด้านความปลอดภัยที่อาจถูกโจมตีซึ่งต้องได้รับการแก้ไข
แหล่งข้อมูล
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา 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,["# Insecure API or Library\n\n\u003cbr /\u003e\n\n**OWASP category:** [MASVS-CODE: Code Quality](https://mas.owasp.org/MASVS/10-MASVS-CODE)\n\nOverview\n--------\n\nUsing insecure APIs or libraries significantly reduces an application's security\nposture. A security breach in any of these dependencies would allow an attacker\nto leverage a number of vectors to conduct a broad set of attacks such as man-\nin-the-middle (MitM) and remote code execution (RCE).\n\nThe threat of implementing insecure dependencies arises when developers don't\nintegrate security assessments and vulnerability testing into the Software\nDevelopment Lifecycle (SDLC) or, in some cases, don't implement an automated\nupdate policy for application dependencies.\n\nDependency exploitation usually starts by analyzing application binary (.apk) to\nsearch for vulnerable libraries. At this point, Open Source Intelligence (OSINT)\nis performed to unearth previously discovered potentially exploitable\nvulnerabilities. Attackers can then leverage publicly disclosed vulnerability\ninformation such as common vulnerabilities and exposures (CVEs) to perform\nfurther attacks.\n\nImpact\n------\n\nThe successful exploitation of insecure dependencies can lead to a broad set of\nattacks such as remote code execution (RCE), SQL injections (SQLi), or cross-\nsite scripting (XSS).\nTherefore, the overall impact is directly related to the type of vulnerability\nthat third-party software introduces and that attackers can exploit.\nPossible consequences of a successful exploitation of vulnerable dependencies\nare data breaches or service unavailability, which may lead to a significant\nimpact on reputation and economic turnover.\n\nMitigations\n-----------\n\n### Defense in depth\n\nNote that the mitigations listed below have to be implemented in combination to\nensure a stronger security posture, and reduce the application's attack surface.\nThe exact approach should always be evaluated on a case-by-case basis.\n\n### Dependency vulnerability assessments\n\nImplement dependency verification at the beginning of the development lifecycle\nto detect vulnerabilities within third-party code. This phase tests whether the\ncode that is not built in-house is secure before being rolled out in production\nenvironments.\nVerification could be complemented by implementing static application security\ntesting (SAST) and dynamic application security testing (DAST) tools within the\nsoftware development lifecycle to improve the security posture of the\napplication.\n\n### Continuously update dependencies\n\nAlways be careful to continuously update any dependency embedded within the\ncode. For this purpose, it is recommended to implement automatic updates that\nare pushed to production whenever a third-party component releases a new\nsecurity patch.\n\n### Perform application penetration testing\n\nConduct regular penetration tests. These kinds of tests aim to uncover any well-\nknown vulnerability that could affect proprietary code and, or third-party\ndependencies.\nAdditionally, security assessments frequently uncover unknown vulnerabilities\n(0-days).\nPenetration tests are helpful for developers, as they provide them with a\nsnapshot of the application's current security posture and help them prioritize\nexploitable security issues that have to be addressed.\n\nResources\n---------\n\n- [How to recognise and manage insecure dependencies](https://cheatsheetseries.owasp.org/cheatsheets/Vulnerable_Dependency_Management_Cheat_Sheet.html)\n\n- [GitHub security features](https://docs.github.com/en/code-security/getting-started/github-security-features)\n\n- [How to secure dependencies](https://www.hacksplaining.com/prevention/toxic-dependencies)\n\n- [CWE-1395: Dependency on Vulnerable Third-Party Component](https://cwe.mitre.org/data/definitions/1395.html)\n\n- [SDK implementation best-practices for Android.](/guide/practices/sdk-best-practices)"]]