Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix bcrypt timing attack vulnerability in login flow#51

Open
luisdlopera wants to merge 1 commit into
mainfrom
sentinel/fix-timing-attack-login-17326812143300663532
Open

πŸ›‘οΈ Sentinel: [HIGH] Fix bcrypt timing attack vulnerability in login flow#51
luisdlopera wants to merge 1 commit into
mainfrom
sentinel/fix-timing-attack-login-17326812143300663532

Conversation

@luisdlopera
Copy link
Copy Markdown
Owner

Fixes a high-severity timing attack vulnerability in login.use-case.ts.

  • Replaced invalid bcrypt string with a pre-computed valid string.
  • Fixed a Next.js build error related to useSearchParams() missing a <Suspense> boundary in /auth/page.tsx.
  • Updated .jules/sentinel.md with findings and lessons learned.

PR created automatically by Jules for task 17326812143300663532 started by @luisdlopera

🚨 Severity: HIGH
πŸ’‘ Vulnerability: When authenticating, non-existent users were validated against an invalid bcrypt string (`$2a$12$dummyhash...`). Because `bcryptjs.compare()` fails fast on invalid hash formats (0ms), it bypassed the intended timing attack mitigation, allowing an attacker to determine if an email exists by measuring the response time difference between existing users (~100ms) and non-existing users (0ms).
🎯 Impact: Attackers could enumerate registered users via a timing attack on the login endpoint.
πŸ”§ Fix: Used a pre-computed valid bcrypt hash with the same work factor (10) as real hashes (`$2b$10$...`) for dummy comparisons. Also fixed a `useSearchParams` Suspense boundary error in the frontend.
βœ… Verification: `pnpm build`, `pnpm test`, and `pnpm lint` pass successfully locally.
@google-labs-jules
Copy link
Copy Markdown

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

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