6 개 항목 찾음
취약점
Abstract
프로그램은 AWT/Swing을 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 디스플레이에 정보를 출력하거나 키보드에서 정보를 입력받을 때 AWT 기능을 사용할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"대부분의 서버는 응용 프로그램과 서버 시스템에 연결된 키보드/디스플레이가 직접 상호 작용하는 것을 허용하지 않습니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] Standards Mapping - Common Weakness Enumeration CWE ID 575
desc.structural.java.ejb_bad_practices_use_of_awt_swing
Abstract
프로그램은 클래스 로더를 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 클래스 로더 생성, 현재 클래스 로더 얻기, 컨텍스트 클래스 로더 설정, 보안 관리자(security manager) 설정, 새 보안 관리자(security manager) 생성, JVM 중단 또는 입력, 출력 및 오류 스트림 변경을 할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"이들 함수는 EJB 컨테이너용으로 예약되어 있습니다. enterprise bean이 이들 함수를 사용하면 보안이 약해지고 컨테이너가 런타임 환경을 올바로 관리하는 기능이 저하됩니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] Standards Mapping - Common Weakness Enumeration CWE ID 578
desc.structural.java.ejb_bad_practices_use_of_classloader
Abstract
프로그램은 java.io 패키지를 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 file system의 파일 및 디렉터리에 접근할 때 java.io 패키지를 사용할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"File system API는 비즈니스 구성 요소가 데이터에 접근할 수 있는 기능이 없습니다. 비즈니스 구성 요소는 JDBC와 같은 리소스 관리자 API를 사용하여 데이터를 저장해야 합니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] Standards Mapping - Common Weakness Enumeration CWE ID 576
desc.structural.java.ejb_bad_practices_use_of_java_io
Abstract
프로그램은 소켓을 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 소켓에서 수신 대기하거나 소켓에서 연결을 수락하거나 멀티캐스트에 소켓을 사용할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"EJB 아키텍처를 사용하면 enterprise bean 인스턴스가 네트워크 소켓 클라이언트가 될 수 있지만 네트워크 서버는 될 수가 없습니다. 인스턴스가 네트워크 서버가 되면 EJB 클라이언트에게 서비스를 제공하는 역할에서 enterprise bean의 기본 함수와 충돌합니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] Standards Mapping - Common Weakness Enumeration CWE ID 577
desc.structural.java.ejb_bad_practices_use_of_sockets
Abstract
프로그램은 스레드 동기화 기본 형식을 사용하여 Enterprise JavaBeans 규격을 위반합니다.
Explanation
Enterprise JavaBeans 규격에 따르면 모든 bean 공급자는 bean이 이식 가능하고 EJB 컨테이너에서 일관성 있게 동작하도록 하기 위한 프로그래밍 지침을 따라야 합니다[1].

이 경우, 프로그램은 다음 EJB 지침을 위반합니다.

"enterprise bean은 여러 인스턴스의 실행을 동기화할 때 스레드 동기화 기본 형식을 사용할 수 없습니다."

규격에서 다음과 같이 정당화하는 요구 사항입니다.

"이 규칙은 일부 EJB 컨테이너가 하나의 JVM을 사용하여 모든 enterprise bean의 인스턴스를 실행하는 반면 나머지는 여러 JVM에 인스턴스를 분산시키기 때문에 런타임 의미의 일관성을 유지하기 위해 필요합니다."
References
[1] The Enterprise JavaBeans 2.1 Specification Sun Microsystems
[2] THI01-J. Do not invoke ThreadGroup methods CERT
[3] Standards Mapping - Common Weakness Enumeration CWE ID 574
desc.structural.java.ejb_bad_practices_use_of_synchronization_primitives
Abstract
이 메서드는 확인되지 않은 입력을 JSON에 작성합니다. 이 호출로 공격자는 JSON 엔티티에 임의의 요소나 속성을 삽입할 수 있습니다.
Explanation
JSON injection은 다음 경우에 발생합니다.

1. 신뢰할 수 없는 소스에서 데이터가 프로그램에 입력됩니다.


2. JSON 스트림에 데이터가 작성됩니다.

일반적으로 응용 프로그램은 JSON을 사용하여 데이터를 저장하거나 메시지를 전송합니다. 데이터 저장에 사용될 때 JSON은 주로 캐시된 데이터와 같이 취급되며 민감한 정보를 포함할 수 있습니다. 메시지 전송에 사용될 때 JSON은 주로 RESTful 서비스와 함께 사용되며 인증 자격 증명과 같은 민감한 정보를 전송하는 데 사용될 수 있습니다.

JSON 문서와 메시지의 의미는 응용 프로그램이 확인되지 않은 입력에서 JSON을 구성하는 경우 변경될 수 있습니다. 상대적으로 양호한 경우 공격자는 JSON 문서 또는 요청을 구문 분석하는 동안 응용 프로그램이 예외 사항을 발생시키도록 하는 관련 없는 요소를 삽입할 수도 있습니다. 좀 더 심각한 경우 JSON Injection과 관련된 것과 같이 공격자는 JSON 문서 또는 요청 내에서 주요 비즈니스 값의 예측 가능한 조작을 허용하는 관련 없는 요소를 삽입할 수도 있습니다. JSON Injection이 Cross-Site Scripting 또는 Dynamic Code Evaluation을 유발하는 경우도 있습니다.

예제 1: 다음 C# 코드는 JSON.NET을 사용하여 사용자 제어 입력 변수 usernamepassword에서 C:\user_info.json에 있는 JSON 파일로 권한 없는 사용자("관리자" 역할이 있는 권한 사용자와 반대로 "기본" 역할이 있는 사용자)에 대한 사용자 계정 인증 정보를 직렬화합니다.


...

StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);

using (JsonWriter writer = new JsonTextWriter(sw))
{
writer.Formatting = Formatting.Indented;

writer.WriteStartObject();

writer.WritePropertyName("role");
writer.WriteRawValue("\"default\"");

writer.WritePropertyName("username");
writer.WriteRawValue("\"" + username + "\"");

writer.WritePropertyName("password");
writer.WriteRawValue("\"" + password + "\"");

writer.WriteEndObject();
}

File.WriteAllText(@"C:\user_info.json", sb.ToString());


하지만 JSON 직렬화는 JsonWriter.WriteRawValue()를 사용하여 수행되므로 usernamepassword에서 신뢰하지 않는 데이터는 JSON 관련 특수 문자를 이스케이프 처리하도록 인증되지 않습니다. 이를 통해 사용자는 임의적으로 JSON 키를 삽입하여 직렬화된 JSON 구조를 변경할 수 있습니다. 이 예제에서 암호 Evil123!를 사용하는 권한 없는 사용자 malloryusername 변수 값을 설정하는 프롬프트에 입력 시 ","role":"admin을 사용자 이름에 추가한 경우 C:\user_info.json에 저장된 결과 JSON은 다음과 같습니다.


{
"role":"default",
"username":"mallory",
"role":"admin",
"password":"Evil123!"
}


이 직렬화된 JSON 파일이 JsonConvert.DeserializeObject()Dictionary 개체에 병렬화된 경우 다음과 같습니다.


String jsonString = File.ReadAllText(@"C:\user_info.json");

Dictionary<string, string> userInfo = JsonConvert.DeserializeObject<Dictionary<string, strin>>(jsonString);
Dictionary 개체에 있는 username, passwordrole 키의 결과 값은 각각 mallory, Evil123!admin입니다. 병렬화된 JSON 값이 유효하다는 추가 확인이 없으면 응용 프로그램이 사용자 mallory "관리자" 권한을 잘못 할당합니다.
References
[1] Standards Mapping - Common Weakness Enumeration CWE ID 91
[2] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[3] Standards Mapping - FIPS200 SI
[4] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[5] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[6] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[7] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[8] Standards Mapping - OWASP Mobile 2014 M7 Client Side Injection
[9] Standards Mapping - OWASP Mobile 2024 M4 Insufficient Input/Output Validation
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-CODE-4
[11] Standards Mapping - OWASP Top 10 2004 A6 Injection Flaws
[12] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[13] Standards Mapping - OWASP Top 10 2010 A1 Injection
[14] Standards Mapping - OWASP Top 10 2013 A1 Injection
[15] Standards Mapping - OWASP Top 10 2017 A1 Injection
[16] Standards Mapping - OWASP Top 10 2021 A03 Injection
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.3.1.1, Requirement 6.5.2
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.1
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.1
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.1
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.1
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation
[27] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation, Control Objective C.3.2 - Web Software Attack Mitigation
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3510 CAT I
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3510 CAT I
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3510 CAT I
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3510 CAT I
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3510 CAT I
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3510 CAT I
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3510 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002530 CAT II, APSC-DV-002560 CAT I
[49] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.dataflow.dotnet.json_injection
Abstract
메서드는 확인되지 않은 입력을 JSON에 작성합니다. 그러면 공격자가 JSON 엔터티에 임의의 요소나 속성을 삽입할 수 있습니다.
Explanation
JSON injection은 다음 경우에 발생합니다.

1. 신뢰할 수 없는 소스의 데이터가 프로그램에 입력됩니다.


2. JSON 스트림에 데이터가 작성됩니다.

일반적으로 응용 프로그램은 JSON을 사용하여 데이터를 저장하거나 메시지를 전송합니다. 데이터 저장에 사용될 때 JSON은 주로 캐시된 데이터와 같이 취급되며 중요한 정보를 포함할 수 있습니다. 메시지 전송에 사용될 때 JSON은 주로 RESTful 서비스와 함께 사용되며 인증 자격 증명과 같은 중요한 정보를 전송할 수 있습니다.

응용 프로그램이 확인되지 않은 입력에서 JSON을 생성하는 경우 공격자가 JSON 문서와 메시지의 의미를 변경할 수 있습니다. 상대적으로 양호한 경우 공격자는 JSON 문서 또는 요청을 구문 분석하는 동안 응용 프로그램이 예외 사항을 발생시키도록 하는 관련 없는 요소를 삽입할 수도 있습니다. JSON injection이 진행되는 등의 좀 더 심각한 경우 공격자는 JSON 문서 또는 요청 내에서 주요 비즈니스 값의 예측 가능한 조작을 허용하는 관련 없는 요소를 삽입할 수도 있습니다. JSON injection이 Cross-Site Scripting 또는 Dynamic Code Evaluation을 유발하는 경우도 있습니다.

예제 1: 다음 코드는 사용자 제어 입력 변수 usernamepassword부터 ~/user_info.json에 있는 JSON 파일까지 권한 없는 사용자("관리자" 역할이 있는 권한 사용자가 아닌 "기본" 역할이 있는 사용자)를 위한 사용자 계정 인증 정보를 직렬화합니다.


...
func someHandler(w http.ResponseWriter, r *http.Request){
r.parseForm()
username := r.FormValue("username")
password := r.FormValue("password")
...
jsonString := `{
"username":"` + username + `",
"role":"default"
"password":"` + password + `",
}`
...
f, err := os.Create("~/user_info.json")
defer f.Close()

jsonEncoder := json.NewEncoder(f)
jsonEncoder.Encode(jsonString)
}


이 코드는 문자열 연결을 사용하여 JSON 직렬화를 수행하므로 usernamepassword에서 신뢰할 수 없는 데이터는 JSON 관련 특수 문자를 이스케이프 처리하도록 인증되지 않습니다. 이를 통해 사용자는 임의적으로 JSON 키를 삽입할 수 있으며, 그러면 직렬화된 JSON 구조가 변경될 수 있습니다. 이 예제에서 암호 Evil123!를 사용하는 권한 없는 사용자 mallory가 사용자 이름을 입력할 때 ","role":"admin을 추가하면 ~/user_info.json에 저장되는 결과 JSON은 다음과 같습니다.


{
"username":"mallory",
"role":"default",
"password":"Evil123!",
"role":"admin"
}

병렬화된 JSON 값이 유효하다는 추가 확인이 없으면 응용 프로그램이 사용자 mallory "관리자" 권한을 예기치 않게 할당합니다.
References
[1] Standards Mapping - Common Weakness Enumeration CWE ID 91
[2] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[3] Standards Mapping - FIPS200 SI
[4] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[5] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[6] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[7] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[8] Standards Mapping - OWASP Mobile 2014 M7 Client Side Injection
[9] Standards Mapping - OWASP Mobile 2024 M4 Insufficient Input/Output Validation
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-CODE-4
[11] Standards Mapping - OWASP Top 10 2004 A6 Injection Flaws
[12] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[13] Standards Mapping - OWASP Top 10 2010 A1 Injection
[14] Standards Mapping - OWASP Top 10 2013 A1 Injection
[15] Standards Mapping - OWASP Top 10 2017 A1 Injection
[16] Standards Mapping - OWASP Top 10 2021 A03 Injection
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.3.1.1, Requirement 6.5.2
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.1
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.1
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.1
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.1
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation
[27] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation, Control Objective C.3.2 - Web Software Attack Mitigation
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3510 CAT I
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3510 CAT I
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3510 CAT I
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3510 CAT I
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3510 CAT I
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3510 CAT I
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3510 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002530 CAT II, APSC-DV-002560 CAT I
[49] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.dataflow.golang.json_injection
Abstract
이 메서드는 확인되지 않은 입력을 JSON에 작성합니다. 이 호출로 공격자는 JSON 엔티티에 임의의 요소나 속성을 삽입할 수 있습니다.
Explanation
JSON injection은 다음 경우에 발생합니다.

1. 신뢰할 수 없는 소스에서 데이터가 프로그램에 입력됩니다.


2. JSON 스트림에 데이터가 작성됩니다.

일반적으로 응용 프로그램은 JSON을 사용하여 데이터를 저장하거나 메시지를 전송합니다. 데이터 저장에 사용될 때 JSON은 주로 캐시된 데이터와 같이 취급되며 민감한 정보를 포함할 수 있습니다. 메시지 전송에 사용될 때 JSON은 주로 RESTful 서비스와 함께 사용되며 인증 자격 증명과 같은 민감한 정보를 전송하는 데 사용될 수 있습니다.

JSON 문서와 메시지의 의미는 응용 프로그램이 확인되지 않은 입력에서 JSON을 구성하는 경우 변경될 수 있습니다. 상대적으로 양호한 경우 공격자는 JSON 문서 또는 요청을 구문 분석하는 동안 응용 프로그램이 예외 사항을 발생시키도록 하는 관련 없는 요소를 삽입할 수도 있습니다. 좀 더 심각한 경우 JSON Injection과 관련된 것과 같이 공격자는 JSON 문서 또는 요청 내에서 주요 비즈니스 값의 예측 가능한 조작을 허용하는 관련 없는 요소를 삽입할 수도 있습니다. JSON Injection이 Cross-Site Scripting 또는 Dynamic Code Evaluation을 유발하는 경우도 있습니다.

예제 1: 다음 Java 코드는 Jackson을 사용하여 사용자 제어 입력 변수 usernamepassword에서 ~/user_info.json에 있는 JSON 파일로 권한 없는 사용자("관리자" 역할이 있는 권한 사용자와 반대로 "기본" 역할이 있는 사용자)에 대한 사용자 계정 인증 정보를 직렬화합니다.


...

JsonFactory jfactory = new JsonFactory();

JsonGenerator jGenerator = jfactory.createJsonGenerator(new File("~/user_info.json"), JsonEncoding.UTF8);

jGenerator.writeStartObject();

jGenerator.writeFieldName("username");
jGenerator.writeRawValue("\"" + username + "\"");

jGenerator.writeFieldName("password");
jGenerator.writeRawValue("\"" + password + "\"");

jGenerator.writeFieldName("role");
jGenerator.writeRawValue("\"default\"");

jGenerator.writeEndObject();

jGenerator.close();


하지만 JSON 직렬화는 JsonGenerator.writeRawValue()를 사용하여 수행되므로 usernamepassword에서 신뢰하지 않는 데이터는 JSON 관련 특수 문자를 이스케이프 처리하도록 인증되지 않습니다. 이를 통해 사용자는 임의적으로 JSON 키를 삽입하여 직렬화된 JSON 구조를 변경할 수 있습니다. 이 예제에서 암호 Evil123!를 사용하는 권한 없는 사용자 malloryusername 변수 값을 설정하는 프롬프트에 입력 시 ","role":"admin을 사용자 이름에 추가한 경우 ~/user_info.json에 저장된 결과 JSON은 다음과 같습니다.


{
"username":"mallory",
"role":"admin",
"password":"Evil123!",
"role":"default"
}


이 직렬화된 JSON 파일이 Jackson의 JsonParserHashMap 개체에 병렬화된 경우 다음과 같습니다.


JsonParser jParser = jfactory.createJsonParser(new File("~/user_info.json"));

while (jParser.nextToken() != JsonToken.END_OBJECT) {

String fieldname = jParser.getCurrentName();

if ("username".equals(fieldname)) {
jParser.nextToken();
userInfo.put(fieldname, jParser.getText());
}

if ("password".equals(fieldname)) {
jParser.nextToken();
userInfo.put(fieldname, jParser.getText());
}

if ("role".equals(fieldname)) {
jParser.nextToken();
userInfo.put(fieldname, jParser.getText());
}

if (userInfo.size() == 3)
break;
}

jParser.close();
HashMap 개체에 있는 username, passwordrole 키의 결과 값은 각각 mallory, Evil123!admin입니다. 병렬화된 JSON 값이 유효하다는 추가 확인이 없으면 응용 프로그램이 사용자 mallory "관리자" 권한을 잘못 할당합니다.
References
[1] Standards Mapping - Common Weakness Enumeration CWE ID 91
[2] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[3] Standards Mapping - FIPS200 SI
[4] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[5] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[6] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[7] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[8] Standards Mapping - OWASP Mobile 2014 M7 Client Side Injection
[9] Standards Mapping - OWASP Mobile 2024 M4 Insufficient Input/Output Validation
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-CODE-4
[11] Standards Mapping - OWASP Top 10 2004 A6 Injection Flaws
[12] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[13] Standards Mapping - OWASP Top 10 2010 A1 Injection
[14] Standards Mapping - OWASP Top 10 2013 A1 Injection
[15] Standards Mapping - OWASP Top 10 2017 A1 Injection
[16] Standards Mapping - OWASP Top 10 2021 A03 Injection
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.3.1.1, Requirement 6.5.2
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.1
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.1
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.1
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.1
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation
[27] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation, Control Objective C.3.2 - Web Software Attack Mitigation
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3510 CAT I
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3510 CAT I
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3510 CAT I
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3510 CAT I
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3510 CAT I
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3510 CAT I
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3510 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002530 CAT II, APSC-DV-002560 CAT I
[49] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.dataflow.java.json_injection
Abstract
이 메서드는 확인되지 않은 입력을 JSON에 작성합니다. 이 호출로 공격자는 JSON 엔티티에 임의의 요소나 속성을 삽입할 수 있습니다.
Explanation
JSON injection은 다음 경우에 발생합니다.

1. 신뢰할 수 없는 소스에서 데이터가 프로그램에 입력됩니다.


2. JSON 스트림에 데이터가 작성됩니다.

일반적으로 응용 프로그램은 JSON을 사용하여 데이터를 저장하거나 메시지를 전송합니다. 데이터 저장에 사용될 때 JSON은 주로 캐시된 데이터와 같이 취급되며 민감한 정보를 포함할 수 있습니다. 메시지 전송에 사용될 때 JSON은 주로 RESTful 서비스와 함께 사용되며 인증 자격 증명과 같은 민감한 정보를 전송하는 데 사용될 수 있습니다.

JSON 문서와 메시지의 의미는 응용 프로그램이 확인되지 않은 입력에서 JSON을 구성하는 경우 변경될 수 있습니다. 상대적으로 양호한 경우 공격자는 JSON 문서 또는 요청을 구문 분석하는 동안 응용 프로그램이 예외 사항을 발생시키도록 하는 관련 없는 요소를 삽입할 수도 있습니다. 좀 더 심각한 경우 JSON Injection과 관련된 것과 같이 공격자는 JSON 문서 또는 요청 내에서 주요 비즈니스 값의 예측 가능한 조작을 허용하는 관련 없는 요소를 삽입할 수도 있습니다. JSON Injection이 Cross-Site Scripting 또는 Dynamic Code Evaluation을 유발하는 경우도 있습니다.

예제 1: 다음 JavaScript 코드는 jQuery를 사용하여 값을 URL에서 가져오는 JSON을 구문 분석합니다.


var str = document.URL;
var url_check = str.indexOf('name=');
var name = null;
if (url_check > -1) {
name = decodeURIComponent(str.substring((url_check+5), str.length));
}

$(document).ready(function(){
if (name !== null){
var obj = jQuery.parseJSON('{"role": "user", "name" : "' + name + '"}');
...
}
...
});


여기서 name의 신뢰할 수 없는 데이터는 JSON 관련 특수 문자를 이스케이프하도록 검증되지 않습니다. 이를 통해 사용자는 임의적으로 JSON 키를 삽입하여 직렬화된 JSON 구조를 변경할 수 있습니다. 이 예제에서 권한 없는 사용자 mallory가 URL의 이름 매개 변수에 ","role":"admin를 추가한 경우 JSON은 다음이 됩니다.


{
"role":"user",
"username":"mallory",
"role":"admin"
}


이는 jQuery.parseJSON()에 의해 구문 분석되고 일반 개체로 설정됩니다. 이는 obj.role이 이제 "user" 대신 "admin"를 반환함을 의미합니다.
References
[1] Standards Mapping - Common Weakness Enumeration CWE ID 91
[2] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[3] Standards Mapping - FIPS200 SI
[4] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[5] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[6] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[7] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[8] Standards Mapping - OWASP Mobile 2014 M7 Client Side Injection
[9] Standards Mapping - OWASP Mobile 2024 M4 Insufficient Input/Output Validation
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-CODE-4
[11] Standards Mapping - OWASP Top 10 2004 A6 Injection Flaws
[12] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[13] Standards Mapping - OWASP Top 10 2010 A1 Injection
[14] Standards Mapping - OWASP Top 10 2013 A1 Injection
[15] Standards Mapping - OWASP Top 10 2017 A1 Injection
[16] Standards Mapping - OWASP Top 10 2021 A03 Injection
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.3.1.1, Requirement 6.5.2
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.1
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.1
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.1
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.1
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation
[27] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation, Control Objective C.3.2 - Web Software Attack Mitigation
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3510 CAT I
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3510 CAT I
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3510 CAT I
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3510 CAT I
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3510 CAT I
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3510 CAT I
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3510 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002530 CAT II, APSC-DV-002560 CAT I
[49] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.dataflow.javascript.json_injection
Abstract
이 메서드는 확인되지 않은 입력을 JSON에 작성합니다. 이 호출로 공격자는 JSON 엔티티에 임의의 요소나 속성을 삽입할 수 있습니다.
Explanation
JSON injection은 다음 경우에 발생합니다.

1. 신뢰할 수 없는 소스에서 데이터가 프로그램에 입력됩니다.


2. JSON 스트림에 데이터가 작성됩니다.

일반적으로 응용 프로그램은 JSON을 사용하여 데이터를 저장하거나 메시지를 전송합니다. 데이터 저장에 사용될 때 JSON은 주로 캐시된 데이터와 같이 취급되며 민감한 정보를 포함할 수 있습니다. 메시지 전송에 사용될 때 JSON은 주로 RESTful 서비스와 함께 사용되며 인증 자격 증명과 같은 민감한 정보를 전송하는 데 사용될 수 있습니다.

JSON 문서와 메시지의 의미는 응용 프로그램이 확인되지 않은 입력에서 JSON을 구성하는 경우 변경될 수 있습니다. 상대적으로 양호한 경우 공격자는 JSON 문서 또는 요청을 구문 분석하는 동안 응용 프로그램이 예외 사항을 발생시키도록 하는 관련 없는 요소를 삽입할 수도 있습니다. 좀 더 심각한 경우 JSON Injection과 관련된 것과 같이 공격자는 JSON 문서 또는 요청 내에서 주요 비즈니스 값의 예측 가능한 조작을 허용하는 관련 없는 요소를 삽입할 수도 있습니다. JSON Injection이 Cross-Site Scripting 또는 Dynamic Code Evaluation을 유발하는 경우도 있습니다.

예제 1: 다음 Objective-C 코드는 사용자 제어 가능 필드 _usernameField_passwordField에서 JSON으로 권한 없는 사용자("관리자" 역할이 있는 권한 사용자와 반대로 "기본" 역할이 있는 사용자)에 대한 사용자 계정 인증 정보를 직렬화합니다.


...

NSString * const jsonString = [NSString stringWithFormat: @"{\"username\":\"%@\",\"password\":\"%@\",\"role\":\"default\"}" _usernameField.text, _passwordField.text];


하지만 JSON 직렬화는 NSString.stringWithFormat:를 사용하여 수행되므로 _usernameField_passwordField에서 신뢰하지 않는 데이터는 JSON 관련 특수 문자를 이스케이프 처리하도록 인증되지 않습니다. 이를 통해 사용자는 임의적으로 JSON 키를 삽입하여 직렬화된 JSON 구조를 변경할 수 있습니다. 이 예제에서 암호 Evil123!를 사용하는 권한 없는 사용자 mallory_usernameField 필드에 입력 시 ","role":"admin을 사용자 이름에 추가한 경우 그 결과 JSON은 다음과 같습니다.


{
"username":"mallory",
"role":"admin",
"password":"Evil123!",
"role":"default"
}


이 직렬화된 JSON 문자열이 NSJSONSerialization.JSONObjectWithData:NSDictionary 개체에 병렬화된 경우 다음과 같습니다.


NSError *error;
NSDictionary *jsonData = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&error];
NSDictionary 개체에 있는 username, passwordrole의 결과 값은 각각 mallory, Evil123!admin입니다. 병렬화된 JSON 값이 유효하다는 추가 확인이 없으면 응용 프로그램이 사용자 mallory "관리자" 권한을 잘못 할당합니다.
References
[1] Standards Mapping - Common Weakness Enumeration CWE ID 91
[2] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[3] Standards Mapping - FIPS200 SI
[4] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[5] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[6] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[7] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[8] Standards Mapping - OWASP Mobile 2014 M7 Client Side Injection
[9] Standards Mapping - OWASP Mobile 2024 M4 Insufficient Input/Output Validation
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-CODE-4
[11] Standards Mapping - OWASP Top 10 2004 A6 Injection Flaws
[12] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[13] Standards Mapping - OWASP Top 10 2010 A1 Injection
[14] Standards Mapping - OWASP Top 10 2013 A1 Injection
[15] Standards Mapping - OWASP Top 10 2017 A1 Injection
[16] Standards Mapping - OWASP Top 10 2021 A03 Injection
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.3.1.1, Requirement 6.5.2
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.1
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.1
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.1
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.1
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation
[27] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation, Control Objective C.3.2 - Web Software Attack Mitigation
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3510 CAT I
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3510 CAT I
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3510 CAT I
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3510 CAT I
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3510 CAT I
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3510 CAT I
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3510 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002530 CAT II, APSC-DV-002560 CAT I
[49] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.dataflow.objc.json_injection
Abstract
이 메서드는 확인되지 않은 입력을 JSON에 작성합니다. 이 호출로 공격자는 JSON 엔티티에 임의의 요소나 속성을 삽입할 수 있습니다.
Explanation
JSON injection은 다음 경우에 발생합니다.

1. 신뢰할 수 없는 소스의 데이터가 프로그램에 입력됩니다.


2. JSON 스트림에 데이터가 작성됩니다.

일반적으로 응용 프로그램은 JSON을 사용하여 데이터를 저장하거나 메시지를 전송합니다. 데이터 저장에 사용될 때 JSON은 주로 캐시된 데이터와 같이 취급되며 중요한 정보를 포함할 수 있습니다. 메시지 전송에 사용될 때 JSON은 주로 RESTful 서비스와 함께 사용되며 인증 자격 증명과 같은 중요한 정보를 전송할 수 있습니다.

응용 프로그램이 확인되지 않은 입력에서 JSON을 생성하는 경우, JSON 문서 및 메시지의 의미를 변경할 수 있습니다. 상대적으로 양호한 경우 공격자는 JSON 문서 또는 요청을 구문 분석하는 동안 응용 프로그램이 예외를 발생시키도록 하는 관련 없는 요소를 삽입할 수도 있습니다. JSON 삽입이 진행되는 등의 좀 더 심각한 경우 공격자는 JSON 문서 또는 요청 내에서 주요 비즈니스 값의 예측 가능한 조작을 허용하는 관련 없는 요소를 삽입할 수도 있습니다. JSON 삽입이 Cross-Site Scripting 또는 Dynamic Code Evaluation을 유발하는 경우도 있습니다.

예제: 다음 Python 코드는 URL에서 가져온 신뢰할 수 없는 값으로 json 파일을 업데이트합니다.


import json
import requests
from urllib.parse import urlparse
from urllib.parse import parse_qs

url = 'https://www.example.com/some_path?name=some_value'
parsed_url = urlparse(url)
untrusted_values = parse_qs(parsed_url.query)['name'][0]

with open('data.json', 'r') as json_File:
data = json.load(json_File)

data['name']= untrusted_values

with open('data.json', 'w') as json_File:
json.dump(data, json_File)

...


여기서 name의 신뢰할 수 없는 데이터는 JSON 관련 특수 문자를 이스케이프 처리하도록 검증되지 않습니다. 따라서 사용자는 JSON 키를 임의로 삽입할 수 있으며 결과적으로 직렬화된 JSON의 구조가 변경될 수 있습니다. 이 예에서 권한이 없는 사용자 mallory가 URL의 name 매개 변수에 ","role":"admin을 추가하면 JSON은 다음과 같습니다.


{
"role":"user",
"username":"mallory",
"role":"admin"
}

이제 JSON 파일은 악성 데이터로 변조되었으며 사용자는 "user" 대신 "admin" 액세스 권한을 가집니다.
References
[1] Standards Mapping - Common Weakness Enumeration CWE ID 91
[2] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[3] Standards Mapping - FIPS200 SI
[4] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[5] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[6] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[7] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[8] Standards Mapping - OWASP Mobile 2014 M7 Client Side Injection
[9] Standards Mapping - OWASP Mobile 2024 M4 Insufficient Input/Output Validation
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-CODE-4
[11] Standards Mapping - OWASP Top 10 2004 A6 Injection Flaws
[12] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[13] Standards Mapping - OWASP Top 10 2010 A1 Injection
[14] Standards Mapping - OWASP Top 10 2013 A1 Injection
[15] Standards Mapping - OWASP Top 10 2017 A1 Injection
[16] Standards Mapping - OWASP Top 10 2021 A03 Injection
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.3.1.1, Requirement 6.5.2
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.1
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.1
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.1
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.1
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation
[27] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation, Control Objective C.3.2 - Web Software Attack Mitigation
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3510 CAT I
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3510 CAT I
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3510 CAT I
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3510 CAT I
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3510 CAT I
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3510 CAT I
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3510 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002530 CAT II, APSC-DV-002560 CAT I
[49] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.dataflow.python.json_injection
Abstract
이 메서드는 확인되지 않은 입력을 JSON에 작성합니다. 이 호출로 공격자는 JSON 엔티티에 임의의 요소나 속성을 삽입할 수 있습니다.
Explanation
JSON injection은 다음 경우에 발생합니다.

1. 신뢰할 수 없는 소스에서 데이터가 프로그램에 입력됩니다.


2. JSON 스트림에 데이터가 작성됩니다.

일반적으로 응용 프로그램은 JSON을 사용하여 데이터를 저장하거나 메시지를 전송합니다. 데이터 저장에 사용될 때 JSON은 주로 캐시된 데이터와 같이 취급되며 중요한 정보를 포함할 수 있습니다. 메시지 전송에 사용될 때 JSON은 주로 RESTful 서비스와 함께 사용되며 인증 자격 증명과 같은 중요한 정보를 전송하는 데 사용될 수 있습니다.

JSON 문서와 메시지의 의미는 응용 프로그램이 확인되지 않은 입력에서 JSON을 구성하는 경우 변경될 수 있습니다. 상대적으로 양호한 경우 공격자는 JSON 문서 또는 요청을 구문 분석하는 동안 응용 프로그램이 예외 사항을 발생시키도록 하는 관련 없는 요소를 삽입할 수도 있습니다. 좀 더 심각한 경우 JSON Injection과 관련된 것과 같이 공격자는 JSON 문서 또는 요청 내에서 주요 비즈니스 값의 예측 가능한 조작을 허용하는 관련 없는 요소를 삽입할 수도 있습니다. JSON Injection이 Cross-Site Scripting 또는 Dynamic Code Evaluation을 유발하는 경우도 있습니다.
References
[1] Standards Mapping - Common Weakness Enumeration CWE ID 91
[2] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[3] Standards Mapping - FIPS200 SI
[4] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[5] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[6] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[7] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[8] Standards Mapping - OWASP Mobile 2014 M7 Client Side Injection
[9] Standards Mapping - OWASP Mobile 2024 M4 Insufficient Input/Output Validation
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-CODE-4
[11] Standards Mapping - OWASP Top 10 2004 A6 Injection Flaws
[12] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[13] Standards Mapping - OWASP Top 10 2010 A1 Injection
[14] Standards Mapping - OWASP Top 10 2013 A1 Injection
[15] Standards Mapping - OWASP Top 10 2017 A1 Injection
[16] Standards Mapping - OWASP Top 10 2021 A03 Injection
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.3.1.1, Requirement 6.5.2
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.1
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.1
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.1
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.1
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation
[27] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation, Control Objective C.3.2 - Web Software Attack Mitigation
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3510 CAT I
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3510 CAT I
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3510 CAT I
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3510 CAT I
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3510 CAT I
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3510 CAT I
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3510 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002530 CAT II, APSC-DV-002560 CAT I
[49] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.dataflow.scala.json_injection
Abstract
이 메서드는 확인되지 않은 입력을 JSON에 작성합니다. 이 호출로 공격자는 JSON 엔티티에 임의의 요소나 속성을 삽입할 수 있습니다.
Explanation
JSON injection은 다음 경우에 발생합니다.

1. 신뢰할 수 없는 소스에서 데이터가 프로그램에 입력됩니다.


2. JSON 스트림에 데이터가 작성됩니다.

일반적으로 응용 프로그램은 JSON을 사용하여 데이터를 저장하거나 메시지를 전송합니다. 데이터 저장에 사용될 때 JSON은 주로 캐시된 데이터와 같이 취급되며 민감한 정보를 포함할 수 있습니다. 메시지 전송에 사용될 때 JSON은 주로 RESTful 서비스와 함께 사용되며 인증 자격 증명과 같은 민감한 정보를 전송하는 데 사용될 수 있습니다.

JSON 문서와 메시지의 의미는 응용 프로그램이 확인되지 않은 입력에서 JSON을 구성하는 경우 변경될 수 있습니다. 상대적으로 양호한 경우 공격자는 JSON 문서 또는 요청을 구문 분석하는 동안 응용 프로그램이 예외 사항을 발생시키도록 하는 관련 없는 요소를 삽입할 수도 있습니다. 좀 더 심각한 경우 JSON Injection과 관련된 것과 같이 공격자는 JSON 문서 또는 요청 내에서 주요 비즈니스 값의 예측 가능한 조작을 허용하는 관련 없는 요소를 삽입할 수도 있습니다. JSON Injection이 Cross-Site Scripting 또는 Dynamic Code Evaluation을 유발하는 경우도 있습니다.

예제 1: 다음 Swift 코드는 사용자 제어 가능 필드 usernameFieldpasswordField에서 권한 없는 사용자("관리자" 역할이 있는 권한 사용자와 반대로 "기본" 역할이 있는 사용자)에 대한 사용자 계정 인증 정보를 JSON으로 직렬화합니다.


...
let jsonString : String = "{\"username\":\"\(usernameField.text)\",\"password\":\"\(passwordField.text)\",\"role\":\"default\"}"


하지만 JSON 직렬화는 문자열 보간을 사용하여 수행되므로 usernameFieldpasswordField에서 신뢰할 수 없는 데이터는 JSON 관련 특수 문자를 이스케이프 처리하도록 검증되지 않습니다. 이를 통해 사용자는 임의적으로 JSON 키를 삽입하여 직렬화된 JSON 구조를 변경할 수 있습니다. 이 예제에서 암호 Evil123!를 사용하는 권한 없는 사용자 malloryusernameField 필드에 입력 시 ","role":"admin을 사용자 이름에 추가한 경우 그 결과 JSON은 다음과 같습니다.


{
"username":"mallory",
"role":"admin",
"password":"Evil123!",
"role":"default"
}


이 직렬화된 JSON 문자열이 NSJSONSerialization.JSONObjectWithData:NSDictionary 개체에 병렬화된 경우 다음과 같습니다.


var error: NSError?
var jsonData : NSDictionary = NSJSONSerialization.JSONObjectWithData(jsonString.dataUsingEncoding(NSUTF8StringEncoding), options: NSJSONReadingOptions.MutableContainers, error: &error) as NSDictionary
NSDictionary 개체에 있는 username, passwordrole의 결과 값은 각각 mallory, Evil123!admin입니다. 병렬화된 JSON 값이 유효하다는 추가 확인이 없으면 응용 프로그램이 사용자 mallory "관리자" 권한을 잘못 할당합니다.
References
[1] Standards Mapping - Common Weakness Enumeration CWE ID 91
[2] Standards Mapping - DISA Control Correlation Identifier Version 2 CCI-002754
[3] Standards Mapping - FIPS200 SI
[4] Standards Mapping - General Data Protection Regulation (GDPR) Indirect Access to Sensitive Data
[5] Standards Mapping - NIST Special Publication 800-53 Revision 4 SI-10 Information Input Validation (P1)
[6] Standards Mapping - NIST Special Publication 800-53 Revision 5 SI-10 Information Input Validation
[7] Standards Mapping - OWASP API 2023 API1 Broken Object Level Authorization
[8] Standards Mapping - OWASP Mobile 2014 M7 Client Side Injection
[9] Standards Mapping - OWASP Mobile 2024 M4 Insufficient Input/Output Validation
[10] Standards Mapping - OWASP Mobile Application Security Verification Standard 2.0 MASVS-CODE-4
[11] Standards Mapping - OWASP Top 10 2004 A6 Injection Flaws
[12] Standards Mapping - OWASP Top 10 2007 A2 Injection Flaws
[13] Standards Mapping - OWASP Top 10 2010 A1 Injection
[14] Standards Mapping - OWASP Top 10 2013 A1 Injection
[15] Standards Mapping - OWASP Top 10 2017 A1 Injection
[16] Standards Mapping - OWASP Top 10 2021 A03 Injection
[17] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 Requirement 6.5.6
[18] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 Requirement 6.3.1.1, Requirement 6.5.2
[19] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 Requirement 6.5.1
[20] Standards Mapping - Payment Card Industry Data Security Standard Version 3.0 Requirement 6.5.1
[21] Standards Mapping - Payment Card Industry Data Security Standard Version 3.1 Requirement 6.5.1
[22] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2 Requirement 6.5.1
[23] Standards Mapping - Payment Card Industry Data Security Standard Version 3.2.1 Requirement 6.5.1
[24] Standards Mapping - Payment Card Industry Data Security Standard Version 4.0 Requirement 6.2.4
[25] Standards Mapping - Payment Card Industry Software Security Framework 1.0 Control Objective 4.2 - Critical Asset Protection
[26] Standards Mapping - Payment Card Industry Software Security Framework 1.1 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation
[27] Standards Mapping - Payment Card Industry Software Security Framework 1.2 Control Objective 4.2 - Critical Asset Protection, Control Objective B.3.1 - Terminal Software Attack Mitigation, Control Objective B.3.1.1 - Terminal Software Attack Mitigation, Control Objective C.3.2 - Web Software Attack Mitigation
[28] Standards Mapping - Security Technical Implementation Guide Version 3.1 APP3510 CAT I
[29] Standards Mapping - Security Technical Implementation Guide Version 3.4 APP3510 CAT I
[30] Standards Mapping - Security Technical Implementation Guide Version 3.5 APP3510 CAT I
[31] Standards Mapping - Security Technical Implementation Guide Version 3.6 APP3510 CAT I
[32] Standards Mapping - Security Technical Implementation Guide Version 3.7 APP3510 CAT I
[33] Standards Mapping - Security Technical Implementation Guide Version 3.9 APP3510 CAT I
[34] Standards Mapping - Security Technical Implementation Guide Version 3.10 APP3510 CAT I
[35] Standards Mapping - Security Technical Implementation Guide Version 4.2 APSC-DV-002560 CAT I
[36] Standards Mapping - Security Technical Implementation Guide Version 4.3 APSC-DV-002560 CAT I
[37] Standards Mapping - Security Technical Implementation Guide Version 4.4 APSC-DV-002560 CAT I
[38] Standards Mapping - Security Technical Implementation Guide Version 4.5 APSC-DV-002560 CAT I
[39] Standards Mapping - Security Technical Implementation Guide Version 4.6 APSC-DV-002560 CAT I
[40] Standards Mapping - Security Technical Implementation Guide Version 4.7 APSC-DV-002560 CAT I
[41] Standards Mapping - Security Technical Implementation Guide Version 4.8 APSC-DV-002560 CAT I
[42] Standards Mapping - Security Technical Implementation Guide Version 4.9 APSC-DV-002560 CAT I
[43] Standards Mapping - Security Technical Implementation Guide Version 4.10 APSC-DV-002560 CAT I
[44] Standards Mapping - Security Technical Implementation Guide Version 4.11 APSC-DV-002560 CAT I
[45] Standards Mapping - Security Technical Implementation Guide Version 4.1 APSC-DV-002560 CAT I
[46] Standards Mapping - Security Technical Implementation Guide Version 5.1 APSC-DV-002560 CAT I
[47] Standards Mapping - Security Technical Implementation Guide Version 5.2 APSC-DV-002560 CAT I
[48] Standards Mapping - Security Technical Implementation Guide Version 5.3 APSC-DV-002530 CAT II, APSC-DV-002560 CAT I
[49] Standards Mapping - Web Application Security Consortium Version 2.00 Improper Input Handling (WASC-20)
desc.dataflow.swift.json_injection