This repository was archived by the owner on Jan 5, 2023. It is now read-only.
Go: Add Log Injection query (CWE-117) #609
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a query for Log Injection (CWE-117).
Description
If unsanitized user input is written to a log entry, a malicious user may be able to forge new log entries.
Forgery can occur if a user provides some input with characters that are interpreted when the log output is displayed. If the log is displayed as a plain text file, then new line characters can be used by a malicious user. If the log is displayed as HTML, then arbitrary HTML may be include to spoof log entries.
To consider
No sanitizers were added, following the same reasoning as in the Java version.Post-hoc edit by @smowton: this query DOES sanitize on removal of linebreak characters
Evaluation
The query shows results in 4820 projects. A small sample of them were reviewed and deemed TPs.
References
https://www.owasp.org/index.php/Log_Injection