Skip to content

[Aikido] Fix shell-injection detection bypass via escaped quotes outside quote regions - #506

Closed
aikido-autofix[bot] wants to merge 1 commit into
mainfrom
fix/code-audit-137915012-c9dd
Closed

aikido-autofix[bot] wants to merge 1 commit into
mainfrom
fix/code-audit-137915012-c9dd

Conversation

@aikido-autofix

@aikido-autofix aikido-autofix Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

This patch addresses a shell-injection detection bypass vulnerability in the quote region parsing logic. Escaped quotes occurring outside of properly delimited quote regions were incorrectly being treated as quote delimiters, allowing attackers to fabricate safe regions around malicious shell syntax. The fix ensures that escaped quotes are consistently treated as literal characters rather than region boundaries. Changes were made to isSafelyEncapsulated.go with corresponding test coverage added to isSafelyEncapsulated_test.go and detectShellInjection_test.go.

✅ 1 issue fixed by this PR
Issue Severity           Description
CodeAudit#811698022
HIGH
parseQuoteRegions starts a quote region for every single- or double-quote byte without first determining whether the byte is escaped. Backslash handling is performed only after a region has already been opened. An escaped quote can consequently be paired with a later quote to fabricate a region around an attacker-controlled value. isSafelyEncapsulated trusts that region and detectShellInjection returns without calling containsShellSyntax. The pre-shell handler emits no blocking action when detection returns no result, so a protected PHP shell operation can proceed. This is one parser defect affecting both escaped single-quote and escaped double-quote layouts.

@hansott hansott closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant