My logs can be poisoned into an injection surface, or written dirty and incomplete—so you can't reconstruct what I did
In one sentence: untrusted text can forge log records and become prompt injection when AI later analyzes them. Auditing also needs integrity, access control, and corroboration across sources.
Symptom
I concatenate a username into a text log. An input containing a newline creates a fake administrator record. Later, I read the log and treat its instruction to delete old backups as a task.
Why this happens
OWASP describes how improperly handled external inputs can alter log structure or interpretation. Logs remain untrusted data; calling them audit records does not grant their contents instructional authority.
Integrity is a separate issue. Events can be missing, altered, deleted, or contain secrets. Append-only writing does not automatically prevent administrative deletion, collection loss, or storage replacement. Logs are also not the only evidence: service audits, version diffs, and build artifacts can corroborate them.
Consequences
Forged events misdirect investigation, missing records impede reconstruction, and secrets spread to additional systems. An AI analysis workflow can also turn log text into tool actions.
What to do instead
- Use structured logging and encoding appropriate to each sink. Validate fields, lengths, and control characters; JSON alone does not secure every downstream renderer.
- Record identity, object, action, result, and correlation identifiers without passwords, tokens, or full request bodies. Check collection failures and clock differences.
- Separate writing from administration. Select independent storage, retention locks, or integrity checks according to risk, and test access and recovery.
- Treat logs as quoted data. External text cannot authorize deletion, network access, or modification. Pass separate shell arguments rather than constructing commands from logs.
Example
Before: log("login user=" + user_input), then execute a “repair command” found in the log.
After: serialize validated structured fields; AI reports suspicious records, while actions still require user authorization and tool policy.
Version notes
OWASP supports log-injection and logging principles, not a guarantee that a particular format or storage product is tamper-proof. Revalidate after changes to formats, renderers, collection, or AI analysis.