Logo
-

Byte Open Security

(ByteOS Network)

Log In

Sign Up

ByteOS

Security
Vulnerability Details
Registries
Custom Views
Weaknesses
Attack Patterns
Filters & Tools
CWE-117:Improper Output Neutralization for Logs
Weakness ID:117
Version:v4.17
Weakness Name:Improper Output Neutralization for Logs
Vulnerability Mapping:Allowed
Abstraction:Base
Structure:Simple
Status:Draft
Likelihood of Exploit:Medium
DetailsContent HistoryObserved CVE ExamplesReports
▼Description

The product constructs a log message from external input, but it does not neutralize or incorrectly neutralizes special elements when the message is written to a log file.

diagram
▼Extended Description

▼Alternate Terms
Log forging

An attack-oriented term that could be used in cases in which the adversary can add additional log entries or modify how a log entry is parsed.

▼Relationships
Relevant to the view"Research Concepts - (1000)"
NatureMappingTypeIDName
ChildOfAllowed-with-ReviewC116Improper Encoding or Escaping of Output
ParentOfAllowedB93Improper Neutralization of CRLF Sequences ('CRLF Injection')
Nature: ChildOf
Mapping: Allowed-with-Review
Type: Class
ID: 116
Name: Improper Encoding or Escaping of Output
Nature: ParentOf
Mapping: Allowed
Type: Base
ID: 93
Name: Improper Neutralization of CRLF Sequences ('CRLF Injection')
▼Memberships
NatureMappingTypeIDName
MemberOfProhibitedC137Data Neutralization Issues
MemberOfProhibitedC727OWASP Top Ten 2004 Category A6 - Injection Flaws
MemberOfProhibitedV884CWE Cross-section
MemberOfProhibitedC963SFP Secondary Cluster: Exposed Data
MemberOfProhibitedC1009Audit
MemberOfProhibitedC1134SEI CERT Oracle Secure Coding Standard for Java - Guidelines 00. Input Validation and Data Sanitization (IDS)
MemberOfProhibitedC1210Audit / Logging Errors
MemberOfProhibitedC1355OWASP Top Ten 2021 Category A09:2021 - Security Logging and Monitoring Failures
MemberOfProhibitedC1407Comprehensive Categorization: Improper Neutralization
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 137
Name: Data Neutralization Issues
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 727
Name: OWASP Top Ten 2004 Category A6 - Injection Flaws
Nature: MemberOf
Mapping: Prohibited
Type:View
ID: 884
Name: CWE Cross-section
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 963
Name: SFP Secondary Cluster: Exposed Data
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1009
Name: Audit
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1134
Name: SEI CERT Oracle Secure Coding Standard for Java - Guidelines 00. Input Validation and Data Sanitization (IDS)
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1210
Name: Audit / Logging Errors
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1355
Name: OWASP Top Ten 2021 Category A09:2021 - Security Logging and Monitoring Failures
Nature: MemberOf
Mapping: Prohibited
Type:Category
ID: 1407
Name: Comprehensive Categorization: Improper Neutralization
▼Tags
NatureMappingTypeIDName
MemberOfProhibitedBSBOSS-273Medium likelihood of exploit
MemberOfProhibitedBSBOSS-279Input Validation Strategy
MemberOfProhibitedBSBOSS-284Output Encoding Strategy
MemberOfProhibitedBSBOSS-294Not Language-Specific Weaknesses
MemberOfProhibitedBSBOSS-311Execute Unauthorized Code or Commands (impact)
MemberOfProhibitedBSBOSS-318Modify Application Data (impact)
MemberOfProhibitedBSBOSS-322Hide Activities (impact)
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-273
Name: Medium likelihood of exploit
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-279
Name: Input Validation Strategy
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-284
Name: Output Encoding Strategy
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-294
Name: Not Language-Specific Weaknesses
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-311
Name: Execute Unauthorized Code or Commands (impact)
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-318
Name: Modify Application Data (impact)
Nature: MemberOf
Mapping: Prohibited
Type:BOSSView
ID: BOSS-322
Name: Hide Activities (impact)
▼Relevant To View
Relevant to the view"Architectural Concepts - (1008)"
NatureMappingTypeIDName
MemberOfProhibitedC1009Audit
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 1009
Name: Audit
Relevant to the view"Weaknesses Addressed by the SEI CERT Oracle Coding Standard for Java - (1133)"
NatureMappingTypeIDName
MemberOfProhibitedC1134SEI CERT Oracle Secure Coding Standard for Java - Guidelines 00. Input Validation and Data Sanitization (IDS)
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 1134
Name: SEI CERT Oracle Secure Coding Standard for Java - Guidelines 00. Input Validation and Data Sanitization (IDS)
Relevant to the view"Software Development - (699)"
NatureMappingTypeIDName
MemberOfProhibitedC1210Audit / Logging Errors
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 1210
Name: Audit / Logging Errors
Relevant to the view"OWASP Top Ten (2021) - (1344)"
NatureMappingTypeIDName
MemberOfProhibitedC1355OWASP Top Ten 2021 Category A09:2021 - Security Logging and Monitoring Failures
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 1355
Name: OWASP Top Ten 2021 Category A09:2021 - Security Logging and Monitoring Failures
Relevant to the view"Software Development - (699)"
NatureMappingTypeIDName
MemberOfProhibitedC137Data Neutralization Issues
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 137
Name: Data Neutralization Issues
Relevant to the view"Software Fault Pattern (SFP) Clusters - (888)"
NatureMappingTypeIDName
MemberOfProhibitedC963SFP Secondary Cluster: Exposed Data
Nature: MemberOf
Mapping: Prohibited
Type: Category
ID: 963
Name: SFP Secondary Cluster: Exposed Data
▼Background Detail

Applications typically use log files to store a history of events or transactions for later review, statistics gathering, or debugging. Depending on the nature of the application, the task of reviewing log files may be performed manually on an as-needed basis or automated with a tool that automatically culls logs for important events or trending information.

▼Common Consequences
ScopeLikelihoodImpactNote
IntegrityConfidentialityAvailabilityNon-RepudiationN/AModify Application DataHide ActivitiesExecute Unauthorized Code or Commands

Interpretation of the log files may be hindered or misdirected if an attacker can supply data to the application that is subsequently logged verbatim. In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. Forged or otherwise corrupted log files can be used to cover an attacker's tracks, possibly by skewing statistics, or even to implicate another party in the commission of a malicious act. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. An attacker may inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility.

Scope: Integrity, Confidentiality, Availability, Non-Repudiation
Likelihood: N/A
Impact: Modify Application Data, Hide Activities, Execute Unauthorized Code or Commands
Note:

Interpretation of the log files may be hindered or misdirected if an attacker can supply data to the application that is subsequently logged verbatim. In the most benign case, an attacker may be able to insert false entries into the log file by providing the application with input that includes appropriate characters. Forged or otherwise corrupted log files can be used to cover an attacker's tracks, possibly by skewing statistics, or even to implicate another party in the commission of a malicious act. If the log file is processed automatically, the attacker can render the file unusable by corrupting the format of the file or injecting unexpected characters. An attacker may inject code or other commands into the log file and take advantage of a vulnerability in the log processing utility.

▼Potential Mitigations
Phase:Implementation
Mitigation ID: MIT-5
Strategy: Input Validation
Effectiveness:
Description:

Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.

When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."

Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.

Note:


Phase:Implementation
Mitigation ID: MIT-30
Strategy: Output Encoding
Effectiveness:
Description:

Use and specify an output encoding that can be handled by the downstream component that is reading the output. Common encodings include ISO-8859-1, UTF-7, and UTF-8. When an encoding is not specified, a downstream component may choose a different encoding, either by assuming a default encoding or automatically inferring which encoding is being used, which can be erroneous. When the encodings are inconsistent, the downstream component might treat some character or byte sequences as special, even if they are not special in the original encoding. Attackers might then be able to exploit this discrepancy and conduct injection attacks; they even might be able to bypass protection mechanisms that assume the original encoding is also being used by the downstream component.

Note:


Phase:Implementation
Mitigation ID: MIT-20
Strategy: Input Validation
Effectiveness:
Description:

Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.

Note:

▼Modes Of Introduction
Phase: Implementation
Note:

REALIZATION: This weakness is caused during implementation of an architectural security tactic.

▼Applicable Platforms
Languages
Class: Not Language-Specific(Undetermined Prevalence)
▼Demonstrative Examples
Example 1

The following web application code attempts to read an integer value from a request object. If the parseInt call fails, then the input is logged with an error message indicating what happened.

Language: ( code)
N/A

Language: Java(Bad code)
String val = request.getParameter("val"); try { int value = Integer.parseInt(val); } catch (NumberFormatException) { log.info("Failed to parse val = " + val); } ...

Language: ( code)
N/A

If a user submits the string "twenty-one" for val, the following entry is logged:

Language: ( code)
N/A
  • INFO: Failed to parse val=twenty-one

Language: ( code)
N/A

However, if an attacker submits the string "twenty-one%0a%0aINFO:+User+logged+out%3dbadguy", the following entry is logged:

Language: ( code)
N/A
  • INFO: Failed to parse val=twenty-one
  • INFO: User logged out=badguy

Language: ( code)
N/A

Clearly, attackers can use this same mechanism to insert arbitrary log entries.

▼Observed Examples
ReferenceDescription
CVE-2006-4624
Chain: inject fake log entries with fake timestamps using CRLF injection
Reference: CVE-2006-4624
Description:
Chain: inject fake log entries with fake timestamps using CRLF injection
▼Affected Resources
    ▼Functional Areas
      ▼Weakness Ordinalities
      OrdinalityDescription
      Primary
      N/A
      Ordinality: Primary
      Description:
      N/A
      ▼Detection Methods
      Automated Static Analysis
      Detection Method ID:DM-14
      Description:

      Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

      Effectiveness:High
      Note:

      N/A

      ▼Vulnerability Mapping Notes
      Usage:Allowed
      Reason:Acceptable-Use
      Rationale:

      This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.

      Comments:

      Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.

      Suggestions:
      ▼Notes
      ▼Taxonomy Mappings
      Taxonomy NameEntry IDFitEntry Name
      7 Pernicious KingdomsN/AN/ALog Forging
      Software Fault PatternsSFP23N/AExposed Data
      The CERT Oracle Secure Coding Standard for Java (2011)IDS03-JExactDo not log unsanitized user input
      SEI CERT Oracle Coding Standard for JavaIDS03-JExactDo not log unsanitized user input
      Taxonomy Name: 7 Pernicious Kingdoms
      Entry ID: N/A
      Fit: N/A
      Entry Name: Log Forging
      Taxonomy Name: Software Fault Patterns
      Entry ID: SFP23
      Fit: N/A
      Entry Name: Exposed Data
      Taxonomy Name: The CERT Oracle Secure Coding Standard for Java (2011)
      Entry ID: IDS03-J
      Fit: Exact
      Entry Name: Do not log unsanitized user input
      Taxonomy Name: SEI CERT Oracle Coding Standard for Java
      Entry ID: IDS03-J
      Fit: Exact
      Entry Name: Do not log unsanitized user input
      ▼Related Attack Patterns
      IDName
      CAPEC-268
      Audit Log Manipulation
      CAPEC-81
      Web Server Logs Tampering
      CAPEC-93
      Log Injection-Tampering-Forging
      ID: CAPEC-268
      Name: Audit Log Manipulation
      ID: CAPEC-81
      Name: Web Server Logs Tampering
      ID: CAPEC-93
      Name: Log Injection-Tampering-Forging
      ▼References
      Reference ID: REF-6
      Title: Seven Pernicious Kingdoms: A Taxonomy of Software Security Errors
      Author: Katrina Tsipenyuk, Brian Chess, Gary McGraw
      Section:
      Publication:
      NIST Workshop on Software Security Assurance Tools Techniques and Metrics
      Publisher:NIST
      Edition:
      URL:https://samate.nist.gov/SSATTM_Content/papers/Seven%20Pernicious%20Kingdoms%20-%20Taxonomy%20of%20Sw%20Security%20Errors%20-%20Tsipenyuk%20-%20Chess%20-%20McGraw.pdf
      URL Date:
      Day:07
      Month:11
      Year:2005
      Reference ID: REF-52
      Title: Exploiting Software: How to Break Code
      Author: Greg Hoglund, Gary McGraw
      Section:
      Publication:
      Publisher:Addison-Wesley
      Edition:
      URL:http://www.exploitingsoftware.com/
      URL Date:
      Day:27
      Month:02
      Year:2004
      Reference ID: REF-53
      Title: The night the log was forged
      Author: Alec Muffet
      Section:
      Publication:
      Publisher:
      Edition:
      URL:http://doc.novsu.ac.ru/oreilly/tcpip/puis/ch10_05.htm
      URL Date:
      Day:N/A
      Month:N/A
      Year:N/A
      Reference ID: REF-43
      Title: OWASP TOP 10
      Author: OWASP
      Section:
      Publication:
      Publisher:
      Edition:
      URL:https://github.com/owasp-top/owasp-top-2007
      URL Date:
      Day:18
      Month:05
      Year:2007
      Details not found