--- url: "https://owasp.org/Top10/2025/ko/A05_2025-Injection/" titulek: "A05 ě¸ě ě…˜ - OWASP Top 10:2025" h1: "A05:2025 ě¸ě ě…˜" popis: "OWASP Top 10:2025" jazyk: "ko" kanonicka: "https://owasp.org/Top10/2025/ko/A05_2025-Injection/" drobecky: [] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 10:09:37" znaku: 13129 slov: 1384 kodovani: "iso-8859-2" sha256: "856a4f1a0383e55b4de705f343cc6d6c6a5047f3182658f9df1709bb18ee1a86" --- # A05:2025 ě¸ě ě…˜ ## 배경. ě¸ě ě…˜ě€ 3위에서 5위로 두 단계 하락했으며, A04:2025-암호 체계 실패 및 A06:2025-ě•ˆě „í•˜ě§€ 않은 설계 대비 ěƒëŒ€ě  위치는 변동이 없다. ě¸ě ě…˜ě€ 가장 많이 테스트 된 ěš´í…Œęł ëŚŹ 중 하나로, 조사된 ëŞ¨ë“ ě• í”ŒëŚŹěź€ě´ě…˜ě—ě„œ 테스트 되었다. ě¸ě ě…˜ě€ 다른 ěš´í…Œęł ëŚŹëł´ë‹¤ 가장 많은 수의 CVE뼟 ëł´ěœ í–ˆěœźëŠ°, 총 37개의 CWE가 포함되었다. 이 ěš´í…Œęł ëŚŹě—ëŠ” 총 3만 개가 넘는 CVE가 ëł´ęł ëœ 크로스 사이트 스크립팅(높은 빈도/낮은 영향)ęłź 1만 4천 개가 넘는 CVE가 ëł´ęł ëœ SQL ě¸ě ě…˜(낮은 빈도/높은 영향)이 포함되었다. CWE-79 웹 페이지 생성 중 ěž…ë Ľę°’ě˜ ëś€ě ě ˆí•œ 중립화(크로스 사이트 스크립팅)에 대한 ëł´ęł ëœ CVE 수가 매우 많아 이 ěš´í…Œęł ëŚŹě˜ í‰ęˇ ę°€ě¤‘ 영향도가 낮아졌다. ## ě ěˆ˜í‘œ. | 해당되는 CWE 개수 | 최대 ěˇ¨ě•˝ě  ë°œěƒëĽ | í‰ęˇ ěˇ¨ě•˝ě  ë°œěƒëĽ | 최대 테스트 커버리지 | í‰ęˇ í…ŒěŠ¤íŠ¸ 커버리지 | í‰ęˇ ę°€ě¤‘ 악용도 | í‰ęˇ ę°€ě¤‘ 영향도 | 총 발생 깴수 | 총 CVE 깴수 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | | 37 | 13.77% | 3.08% | 100.00% | 42.93% | 7.15 | 4.32 | 1,404,249 | 62,445 | ## 설명. ě¸ě ě…˜ ěˇ¨ě•˝ě ě€ ě‹ ë˘°í• ěˆ˜ 없는 사용자 ěž…ë Ľě´ 인터프리터(예: ë¸Œëźěš°ě €, ë°ě´í„°ë˛ ě´ěŠ¤, 커맨드 라인)로 ě „ě†Ąë˜ě–´ 인터프리터가 해당 ěž…ë Ľě˜ 일부를 ëŞ…ë šěœźëĄœ 실행하도록 허용하는 ě• í”ŒëŚŹěź€ě´ě…˜ 결함이다. 다음과 같은 경우 ě¸ě ě…˜ 공격에 ěˇ¨ě•˝í• ěˆ˜ 있다. - 사용자가 ě œęłľí•œ 데이터가 ě• í”ŒëŚŹěź€ě´ě…˜ě— 의해 검증, 필터링 또는 새니타이징되지 않는 경우. - ë™ě  쿟댏 또는 파라미터 바인딩이 없는 호출을 해당 컨텍스트에 맞는 이스케이프 없이 인터프리터에 ě§ě ‘ ě „ë‹Źí•˜ëŠ” 경우. - 객체 관계형 매핑(object-relational mapping, ORM) 검색 파라미터에 새니타이징되지 않은 ěž…ë Ľę°’ě„ 사용하여, 의도하지 않은 추가 믟감 데이터 ë ˆě˝”ë“œëĽź 조회하는 경우. - ěž ěžŹě ěœźëĄœ ě•…ě˜ě ěź 수 있는 데이터가 그대로 사용되거나, 기쥴 SQL 또는 커맨드 뒤에 문자열로 이어 붙여지는 경우. ꡸ 결곟 ë™ě  쿟댏, 커맨드, 또는 ě €ěžĽ í”„ëĄœě‹œě €ě—ě„œ 원래의 꾏돸곟 공격자가 주입한 악성 데이터가 함께 포함되게 된다. ëŒ€í‘œě ě¸ ě¸ě ě…˜ ěœ í˜•ěœźëĄœëŠ” SQL, NoSQL, OS 커맨드, 객체 관계형 매핑(ORM), LDAP, ęˇ¸ëŚŹęł EL 표현식(Expression Language) 및 OGNL 표현식(Object Graph Navigation Library) ě¸ě ě…˜ě´ 있다. 인터프리터 종류가 달라도 핵심 원리는 동일하다. íš¨ęłźě ě¸ 탐지를 위해서는 소스 코드 리뷰와 함께, ëŞ¨ë“ íŒŒëźëŻ¸í„°, 헤더, URL, ěż í‚¤, JSON, SOAP, 및 XML 데이터 ěž…ë Ľě— 대한 자동화(퍼징 포함) 테스트하는 枌 좋다. CI/CD 파이프라인에 ě •ě (SAST), ë™ě (DAST), 및 인터랙티브(IAST) ě• í”ŒëŚŹěź€ě´ě…˜ 보안 테스트 도구를 통합하여, 것도 운영 환경 배포 ě „ě— ě¸ě ě…˜ 결함을 식별하는 데 도움이 ë ěˆ˜ 있다. 한편 LLM 환경에서도 ěœ ě‚Źí•œ 계열의 ě¸ě ě…˜ ěˇ¨ě•˝ě ě´ í”í•´ě§€ęł ěžˆë‹¤. 이는 [OWASP LLM Top 10](https://genai.owasp.org/llm-top-10/)에서 별도로 다룬다. 특히 [LLM01:2025 프롬프트 ě¸ě ě…˜](https://genai.owasp.org/llmrisk/llm01-prompt-injection/) 항목에서 ę´€ë ¨ 내용을 í™•ě¸í• ěˆ˜ 있다. ## 대응 방안. ě¸ě ě…˜ 공격을 예방하는 ěľœě„ ě˜ 방법은 데이터를 ëŞ…ë š 및 쿼리로부터 분리하여 ěœ ě§€í•˜ëŠ” 것이다. - 가장 권장되는 방식은 ě•ˆě „í•œ API뼟 사용하는 것이다. 이는 인터프리터를 ě „í˜€ 사용하지 않거나, ěž…ë Ľę°’ě„ 파라미터화하도록 하는 인터페이스를 ě œęłľí•˜ęą°ë‚˜, 객체 관계형 매핑(ORM) 도구를 사용하는 방식을 통해 이를 ë‹Źě„ąí• ěˆ˜ 있다. **ě°¸ęł :** ě €ěžĽ í”„ëĄœě‹œě €ëŠ” 파라미터화되어 있더라도, PL/SQL 또는 T‑SQL 내부에서 문자열 결합으로 쿼리와 데이터를 연결하거나, EXECUTE IMMEDIATE / exec()처럼 ë™ě  실행 기능으로 ě ëŒ€ě  ěž…ë Ľě„ 실행하면 SQL ě¸ě ě…˜ě´ ë°œěƒí• ěˆ˜ 있다. 데이터를 커맨드로부터 분리하는 것이 불가능한 경우, 다음 방법을 사용하여 위협을 줄일 수 있다. - 서버 츥 ěž…ë Ľę°’ 검증은 허용 목록 기반(positive validation)을 사용한다. 다만 텍스트 ěž…ë Ľëž€ě´ë‚˜ 모바일 API처럼 특수문자 ěž…ë Ľě´ 필요한 경우가 많아, 이것만으로는 ě™„ě „í•œ 방어가 되기 ě–´ë ľë‹¤. - 불가피하게 ë™ě  쿟댏뼟 사용하는 ě§€ě ě´ 남아 있다면, 사용 중인 인터프리터에서 사용하는 규칙에 맞춰 특수문자를 이스케이프 처리한다. **ě°¸ęł :** 테이블 명과 칼럼 명 같은 SQL 구문들은 ě´ěŠ¤ěź€ě´í”„í• ěˆ˜ 없으므로, 사용자가 ě œęłľí•œ ěž…ë Ľę°’ě„ 쓰는 것은 위험하다. 이런 ëŹ¸ě œëŠ” ëł´ęł ě„œ 생성 기능에서 자주 나타난다. **경ęł** 위 방법들은 문자열을 íŒŒě‹ąí•˜ęł ě´ěŠ¤ěź€ě´í”„í•˜ëŠ” 복잡한 처댏뼟 ě „ě œëĄœ 하며, 구현 실수가 발생하기 ě‰˝ęł ě‹œěŠ¤í…œ 내부 동작이 조금만 바뀌어도 방어가 쉽게 ëŹ´ë Ľí™”ë ěˆ˜ 있다. ## 곾겊 시나리오 예시. **시나리오 1:** ě• í”ŒëŚŹěź€ě´ě…˜ě´ ě‹ ë˘°í• ěˆ˜ 없는 데이터를 사용하여 다음과 같은 취약 방식으로 SQL을 호출한다. ``` String query = "SELECT * FROM accounts WHERE custID='" + request.getParameter("id") + "'"; ``` 공격자는 'id' 값에 `' OR '1'='1`와 같은 페이로드를 주입하여 다음과 같이 요청을 보낼 수 있다. ``` http://example.com/app/accountView?id=' OR '1'='1 ``` ꡸ 결곟 쿼리의 내용이 변경되어 accounts 테이블의 ě „ě˛´ ë ˆě˝”ë“œę°€ ěĄ°íšŒë ěˆ˜ 있다. 상황에 따라 공격자는 데이터 변경 및 ě‚­ě œ 또는 ě €ěžĽëœ í”„ëĄœě‹œě € 실행 등 더 심각한 행위를 ěœ ë„í• ěˆ˜ë„ 있다. **시나리오 2:** í”„ë ˆěž„ě›ŒíŹëĽź 사용하더라도 이를 ęłźě‹ í•˜ëŠ´, ě—Źě „ížˆ ě¸ě ě…˜ě— ěˇ¨ě•˝í• ěˆ˜ 있다. 취약한 하이퍼네이트 쿟댏 언어(Hibernate Query Language, HQL)의 경우를 보자. ``` Query HQLQuery = session.createQuery("FROM accounts WHERE custID='" + request.getParameter("id") + "'"); ``` 공격자는 ěž…ë Ľę°’ěœźëĄœ `' OR custID IS NOT NULL OR custID='`뼟 ěž…ë Ľí•œë‹¤. 이는 필터를 ěš°íšŒí•˜ęł ëŞ¨ë“ ęł„ě •ě˜ ë ˆě˝”ë“œëĽź 반환한다. HQL은 로우(raw) SQL보다 위험한 함수가 더 ě ě§€ë§Œ, 사용자 ěž…ë Ľ 값이 쿼리의 문자열로 ě—°ę˛°ë ë•Œ ě—Źě „ížˆ 권한이 없는 데이터 ě ‘ęˇźí• ěˆ˜ 있다. **시나리오 3:** ě• í”ŒëŚŹěź€ě´ě…˜ě´ 사용자 ěž…ë Ľě„ OS 커맨드로 사용한다. ``` String cmd = "nslookup " + request.getParameter("domain"); Runtime.getRuntime().exec(cmd); ``` 공격자는 `example.com; cat /etc/passwd`뼟 ěž…ë Ľí•˜ě—Ź 서버에서 임의의 ëŞ…ë šě„ 실행한다. ## 참쥰. - [OWASP Proactive Controls: Secure Database Access](https://owasp.org/www-project-proactive-controls/v3/en/c3-secure-database) - [OWASP ASVS: V5 Input Validation and Encoding](https://owasp.org/www-project-application-security-verification-standard) - [OWASP Testing Guide: SQL Injection,](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/05-Testing_for_SQL_Injection) [Command Injection](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/12-Testing_for_Command_Injection) , and [ORM Injection](https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/05.7-Testing_for_ORM_Injection) - [OWASP Cheat Sheet: Injection Prevention](https://cheatsheetseries.owasp.org/cheatsheets/Injection_Prevention_Cheat_Sheet.html) - [OWASP Cheat Sheet: SQL Injection Prevention](https://cheatsheetseries.owasp.org/cheatsheets/SQL_Injection_Prevention_Cheat_Sheet.html) - [OWASP Cheat Sheet: Injection Prevention in Java](https://cheatsheetseries.owasp.org/cheatsheets/Injection_Prevention_Cheat_Sheet_in_Java.html) - [OWASP Cheat Sheet: Query Parameterization](https://cheatsheetseries.owasp.org/cheatsheets/Query_Parameterization_Cheat_Sheet.html) - [OWASP Automated Threats to Web Applications – OAT-014](https://owasp.org/www-project-automated-threats-to-web-applications/) - [PortSwigger: Server-side template injection](https://portswigger.net/kb/issues/00101080_serversidetemplateinjection) - [Awesome Fuzzing: a list of fuzzing resources](https://github.com/secfigo/Awesome-Fuzzing) ## 해당되는 CWE 목록. - [CWE-20 Improper Input Validation](https://cwe.mitre.org/data/definitions/20.html) - [CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')](https://cwe.mitre.org/data/definitions/74.html) - [CWE-76 Improper Neutralization of Equivalent Special Elements](https://cwe.mitre.org/data/definitions/76.html) - [CWE-77 Improper Neutralization of Special Elements used in a Command ('Command Injection')](https://cwe.mitre.org/data/definitions/77.html) - [CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')](https://cwe.mitre.org/data/definitions/78.html) - [CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')](https://cwe.mitre.org/data/definitions/79.html) - [CWE-80 Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)](https://cwe.mitre.org/data/definitions/80.html) - [CWE-83 Improper Neutralization of Script in Attributes in a Web Page](https://cwe.mitre.org/data/definitions/83.html) - [CWE-86 Improper Neutralization of Invalid Characters in Identifiers in Web Pages](https://cwe.mitre.org/data/definitions/86.html) - [CWE-88 Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')](https://cwe.mitre.org/data/definitions/88.html) - [CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')](https://cwe.mitre.org/data/definitions/89.html) - [CWE-90 Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection')](https://cwe.mitre.org/data/definitions/90.html) - [CWE-91 XML Injection (aka Blind XPath Injection)](https://cwe.mitre.org/data/definitions/91.html) - [CWE-93 Improper Neutralization of CRLF Sequences ('CRLF Injection')](https://cwe.mitre.org/data/definitions/93.html) - [CWE-94 Improper Control of Generation of Code ('Code Injection')](https://cwe.mitre.org/data/definitions/94.html) - [CWE-95 Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')](https://cwe.mitre.org/data/definitions/95.html) - [CWE-96 Improper Neutralization of Directives in Statically Saved Code ('Static Code Injection')](https://cwe.mitre.org/data/definitions/96.html) - [CWE-97 Improper Neutralization of Server-Side Includes (SSI) Within a Web Page](https://cwe.mitre.org/data/definitions/97.html) - [CWE-98 Improper Control of Filename for Include/Require Statement in PHP Program ('PHP Remote File Inclusion')](https://cwe.mitre.org/data/definitions/98.html) - [CWE-99 Improper Control of Resource Identifiers ('Resource Injection')](https://cwe.mitre.org/data/definitions/99.html) - [CWE-103 Struts: Incomplete validate() Method Definition](https://cwe.mitre.org/data/definitions/103.html) - [CWE-104 Struts: Form Bean Does Not Extend Validation Class](https://cwe.mitre.org/data/definitions/104.html) - [CWE-112 Missing XML Validation](https://cwe.mitre.org/data/definitions/112.html) - [CWE-113 Improper Neutralization of CRLF Sequences in HTTP Headers ('HTTP Response Splitting')](https://cwe.mitre.org/data/definitions/113.html) - [CWE-114 Process Control](https://cwe.mitre.org/data/definitions/114.html) - [CWE-115 Misinterpretation of Output](https://cwe.mitre.org/data/definitions/115.html) - [CWE-116 Improper Encoding or Escaping of Output](https://cwe.mitre.org/data/definitions/116.html) - [CWE-129 Improper Validation of Array Index](https://cwe.mitre.org/data/definitions/129.html) - [CWE-159 Improper Handling of Invalid Use of Special Elements](https://cwe.mitre.org/data/definitions/159.html) - [CWE-470 Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')](https://cwe.mitre.org/data/definitions/470.html) - [CWE-493 Critical Public Variable Without Final Modifier](https://cwe.mitre.org/data/definitions/493.html) - [CWE-500 Public Static Field Not Marked Final](https://cwe.mitre.org/data/definitions/500.html) - [CWE-564 SQL Injection: Hibernate](https://cwe.mitre.org/data/definitions/564.html) - [CWE-610 Externally Controlled Reference to a Resource in Another Sphere](https://cwe.mitre.org/data/definitions/610.html) - [CWE-643 Improper Neutralization of Data within XPath Expressions ('XPath Injection')](https://cwe.mitre.org/data/definitions/643.html) - [CWE-644 Improper Neutralization of HTTP Headers for Scripting Syntax](https://cwe.mitre.org/data/definitions/644.html) - [CWE-917 Improper Neutralization of Special Elements used in an Expression Language Statement ('Expression Language Injection')](https://cwe.mitre.org/data/definitions/917.html)