Repository navigation
[Aikido] Fix SQLite mixed placeholder IDOR bypass in IDOR protector - #444
Closed
aikido-autofix[bot] wants to merge 1 commit into
Closed
aikido-autofix[bot] wants to merge 1 commit into
aikido-autofix[bot] wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 patch addresses an IDOR (Insecure Direct Object Reference) vulnerability in SQLite query analysis where mixed positional placeholders (numbered ?NNN and bare ?) could cause incorrect parameter binding detection. The fix enhances the IDOR protector to validate placeholder consistency and fail safely when the analyzer's ordinal assignment would not match SQLite's actual parameter binding behavior. Changes were made to
lib/aikido/zen/idor/protector.rbandlib/aikido/zen/sql.rbto pass the original SQL query through the protection chain, enabling proper placeholder validation during insert and filter operations.✅ 1 issue fixed by this PR
?tokens and assigns their ordinal among those tokens. The SQLite resolver then returnsparams[placeholder_number]for that ordinal. ForWHERE status = ?1 AND tenant_id = ?with binds[status, requested_tenant_id], the analyzer assigns the tenant placeholder ordinal 0, so the protection layer validatesparams[0]; SQLite assigns?1slot 1 and the later anonymous placeholder slot 2, so the executed tenant predicate usesparams[1]. In an application using this mixed-placeholder pattern where the non-tenant bind is attacker-controlled, an authenticated user can make the check compare a value they control to their own tenant while the query executes against another tenant.