Weak Regex, Big Mess: How I Escaped Input Validation with One Tin
The login form used a weak client-side regex for email validation, and the server did not validate emails properly, allowing an attacker to log in with malformed emails like 'test@internal-admin.' and gain access to internal accounts. This led to access to an internal dashboard with sensitive data.
Free Link 🎈
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the server relied on client-side email validation and did not properly validate the email format on the backend, allowing malformed emails to be accepted.
Impact
The attacker could bypass authentication, enumerate internal accounts, access sensitive data including user sessions and payment logs, and escalate privileges to admin functionality.
What the attacker needed
Access to the staging login portal; guessable or reused passwords
The fix
The server should validate email addresses on the backend using strict rules, not rely on client-side regex.
How it was found
- Found a staging login portal and noticed client-side JavaScript validation.
- Inspected the regex used for email validation and identified its weaknesses.
- Sent a POST request with a malformed email like 'test@internal-admin' and a password.
- Received a 200 OK response with 'Welcome, internal-admin!' indicating successful login.
- Wrote a script to enumerate internal email formats and found multiple valid accounts.
- Accessed the internal dashboard at /internal/dashboard with the compromised credentials.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The website checked email addresses only in the browser, not on the server. A hacker could bypass this check by sending a specially crafted email address directly to the server, which then accepted it and logged them in as an internal user.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.