forked from juice-shop/juice-shop
-
Notifications
You must be signed in to change notification settings - Fork 2
bug: parameterize login query to fix SQL injection (routes/login.ts) #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
matthewguerra-cog
wants to merge
1
commit into
develop
Choose a base branch
from
devin/1789066834-fix-login-sql-injection
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Four login challenges lose exploits
Parameterizing
sequelize.queryrejects the payloads for Login Admin, Login Bender, Login Jim, and Ephemeral Accountant. Their documented SQL-injection path no longer works, leaving several training challenges unsolvable.Learn more
This application deliberately exposes selected vulnerabilities as training features. The login handler is the sole exploit path for the three marked login challenges and for
ephemeralAccountantChallenge. The parameterized query treats each attack string as an email value, so the query returns no user andverifyPostLoginChallengesnever runs. The same change also makes the source shown by the Fix It exercises identical in principle to their correct prepared-statement answer.Example: Posting
jim@juice-sh.op'--previously selected Jim without his password and solved Login Jim. It now searches for that literal email, returns 401, and leaves the challenge unsolved. The UNION payload that synthesizes the accountant user fails in the same way, with no alternative route to create that ephemeral identity.Recommended fix: Preserve the intentional challenge behavior or redesign and migrate all four affected challenges together. If the vulnerability is removed, replace their exploit and detection paths, update challenge metadata and codefix assets, and change the five API assertions to validate the new supported solutions. Run the full API, E2E, and RSN suites after the migration.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentional. This PR exists specifically to remediate the CodeQL
js/sql-injectionfinding (CWE-89, 8.8) on this line in this fork; losing the Login Admin/Bender/Jim and Ephemeral Accountant exploit paths is the expected consequence and is called out in the description. Challenge/test migration is out of scope here — the finding owner has accepted the training-challenge regression in favor of closing the vulnerability.