“email” MFA mode allows bypassing MFA from victim’s device when the device trust is not expired
The MFA implementation could be bypassed by changing the mode from SMS to email and setting secureLogin to false in the login request, allowing an attacker with the victim's credentials to log in without the phone code.
- Triaged in 5 days
- Fixed in 8 days
- Paid in 7 days
- Disclosed after 11 days
Summary by the program
A vulnerability was reported in scope of the Grammarly MFA challenge. No users were affected. @linkworld identified a vulnerability that allowed bypassing MFA if specific conditions were met:
- Attacker has access to
httponly;securetdicookie of the victim's particular device. - Attacker knows
UserAgentof the victim's device. - Attacker can issue a crafted request during a fixed timeframe after the victim has signed in from the particular device.
You can discover additional details about this vulnerability in this comment.
Thanks, @linkworld!
The report
Summary: It is possible bypass MFA without the need to have the phone code.
Description:
When we turn on the MFA and we have the user and password of the user, it is possible bypass the MFA only changing some values the endpoint POST auth.grammarly.com//v3/api/login
Steps To Reproduce:
Note:
-
Use burp suite or another tool to intercept the requests
- Turn on and configure your MFA
- Login with your email and password
- The page of MFA is going to appear
- Enter any random number
- when you press the button "sign in securely" intercept the request POST
auth.grammarly.com/v3/api/loginand in the POST message change the fields:
-
"mode":"sms"by"mode":"email" -
"secureLogin":trueby"secureLogin":false
- send the modification and check, you are in your account! It was not necessary to enter the phone code.
Impact
The attacker can bypass the experimental MFA, If the attacker has the email and password, the attacker can login in the account without the need of the phone code.
Context
Grammarly ran a multi-factor authentication (MFA) challenge on its authentication service, auth.grammarly.com. The feature under test was the MFA step that appears after a correct email and password login: the user is asked for a code, and the login endpoint POST auth.grammarly.com/v3/api/login is what carries the MFA submission.
The report describes this MFA as experimental. The researcher found that the MFA step could be skipped entirely, without the phone code, by changing two fields in the login request. The program's summary states that no users were affected and that the bypass required specific conditions to be met.
Setup
To reproduce, the researcher needed:
- An account with MFA turned on and configured.
- The account's email address and password.
- A request interception tool, such as Burp Suite, to capture and modify the login request.
The program's summary lists the conditions under which the bypass is exploitable against another user:
- The attacker has access to the
httponly;securetdicookie of the victim's particular device. - The attacker knows the
UserAgentof the victim's device. - The attacker can issue a crafted request during a fixed timeframe after the victim has signed in from that particular device.
Finding it
The researcher's starting point was the observation that, with MFA enabled and valid credentials in hand, the MFA step could be bypassed by changing only some values sent to the login endpoint. The endpoint involved is:
POST auth.grammarly.com//v3/api/login
The report gives the endpoint with a double slash in the summary and with a single slash in the reproduction steps. The two fields that mattered were mode and secureLogin.
Exploitation
Step 1: Enable and configure MFA
Turn on MFA on the account and complete its configuration. This puts the account into the state where a code is normally required after the password.
Step 2: Log in with email and password
Submit the account's email address and password. The login proceeds to the MFA page.
Step 3: Reach the MFA page
The MFA prompt appears, asking for the code.
Step 4: Enter any random number
Enter an arbitrary value in the code field. The value does not need to be correct.
Step 5: Intercept the login request and change two fields
Press the "sign in securely" button and intercept the resulting request:
POST auth.grammarly.com/v3/api/login
In the POST message, change the following fields:
"mode":"sms"becomes"mode":"email""secureLogin":truebecomes"secureLogin":false
Step 6: Send the modified request
Send the modified request. According to the researcher, the response puts the session into the account: the phone code was never required.
Root cause
The report does not include the server-side code, so the exact mistake is not shown. What the behaviour implies is that the login endpoint trusted client-supplied fields to decide which MFA mode applied and whether the secure login path was in force. Switching mode from sms to email and secureLogin from true to false changed the server's handling of the request so that the MFA check was not enforced, even though the account had MFA enabled and the submitted code was random.
The program's summary lists conditions for exploiting the bypass against another user: access to the victim's tdi cookie, knowledge of the victim's UserAgent, and a crafted request within a fixed timeframe after the victim signed in from that device. The report does not state how the trust window is measured or how long it lasts.
Impact
The researcher's stated impact is that an attacker who holds the email address and password can log in to the account without the phone code, bypassing the experimental MFA. The program's summary narrows this: no users were affected, and the bypass required access to the victim's tdi cookie for that device, knowledge of the victim's UserAgent, and the ability to send the crafted request within a fixed timeframe after the victim signed in from that device.
Fix
The report does not describe the fix that was applied. What the behaviour calls for is that the server stop deriving the MFA decision from client-controlled mode and secureLogin values, and instead enforce the MFA requirement for the account on the server side regardless of what the client submits.
Variants to test
- On other login endpoints, change the MFA mode field (for example from an SMS value to an email value) while submitting an invalid code. A positive result is a session that reaches the account without a valid code.
- Flip boolean fields that look like they control the login path, such as
secureLogin, betweentrueandfalse. A positive result is a change in whether the MFA step is enforced. - Replay a login request from a device that has completed MFA, keeping the device cookie and
UserAgent, and vary the mode and boolean fields. A positive result is a successful login without a fresh code. - Test whether the device-trust window can be extended or reused after it should have expired. A positive result is a login that succeeds outside the expected timeframe.
Hunting notes
This kind of bug tends to sit in the request that finalises login, where the client tells the server which authentication path it is on. During recon, watch for login requests that carry fields naming an MFA mode or a boolean that switches a security path, and for device cookies such as tdi combined with UserAgent checks. The signal is a request whose security-relevant values are chosen by the client rather than derived from server-side state.
The researcher demonstrated impact by taking an account with MFA enabled, submitting a random code, changing only the two fields, and showing that the session reached the account. The program's summary notes the conditions under which it was exploitable and that no users were affected.
What happened, in plain words
Grammarly ran a multi-factor authentication (MFA) challenge on its login system. MFA is the second lock on an account: after you type your email and password, the site asks for a short code, usually sent to your phone, before it lets you in. The idea is that even if someone steals your password, they still cannot get in without your phone.
The researcher, l1nkworld, found that this second lock could be skipped. With a valid email and password, and with MFA switched on, it was possible to reach the account without ever entering the correct phone code. The trick was to change two small pieces of information in the request the browser sends when you press the sign-in button: one field that says which kind of code is being used, and one field that says whether the "secure login" path is on.
The program's own summary says no users were affected, and that the bypass required specific conditions to be met.
Before going further, a few ideas from zero:
- API: the part of a website that the browser talks to behind the scenes. When you press a button, your browser sends a small message to the server and the server sends one back. Think of it as the kitchen in a restaurant: you (the browser) place an order, the kitchen (the API) prepares it, and the waiter brings the plate back.
- Endpoint: one specific address in that API, like one particular counter in the kitchen. Here the endpoint is the login counter.
- Request: the message your browser sends to the server. It has a method (such as
POST, meaning "here is some data for you"), an address, and a body containing the data. - Field: one named piece of data inside that body, for example
modeorsecureLogin. - Cookie: a small piece of data the server asks your browser to keep and send back on every later request, so the server can recognise you. It is like a cloakroom ticket: you show it and the staff know which coat is yours.
- Token: a value that stands in for proof of identity, similar in spirit to a cookie.
- UserAgent: a short text your browser sends with every request describing itself (browser name, operating system and so on). It is like a name badge saying "I am Firefox on Windows".
- Intercepting a request: catching the message between your browser and the server so you can read it and change it before it is sent. A tool such as Burp Suite does this; it sits in the middle like a postal worker who opens your letter, edits it, and posts it on.
- Vulnerability class (improper authentication): a family of bugs where the system lets someone in who should not be let in, or accepts a weaker proof of identity than it should. This report belongs to that family.
Context
Grammarly ran a multi-factor authentication challenge on its authentication service, auth.grammarly.com. That hostname is the part of Grammarly's infrastructure that handles logging in. The feature under test was the MFA step that appears after a correct email and password login: the user is asked for a code, and the login endpoint POST auth.grammarly.com/v3/api/login is what carries the MFA submission.
The report describes this MFA as experimental, meaning it was a new or trial feature rather than a long-established one. The researcher found that the MFA step could be skipped entirely, without the phone code, by changing two fields in the login request. The program's summary states that no users were affected and that the bypass required specific conditions to be met.
Setup
To reproduce the issue, the researcher needed:
- An account with MFA turned on and configured.
- The account's email address and password.
- A request interception tool, such as Burp Suite, to capture and modify the login request.
Why each of these matters: you need MFA on, otherwise there is no second lock to skip. You need the password, because the whole point is to show that the password alone is not enough and yet still gets you in. And you need a tool that can pause the request, because the change has to happen after the browser has built the message but before the server reads it. A normal browser gives you no way to edit that message by hand.
The program's summary lists the conditions under which the bypass is exploitable against another user:
- The attacker has access to the
httponly;securetdicookie of the victim's particular device. - The attacker knows the
UserAgentof the victim's device. - The attacker can issue a crafted request during a fixed timeframe after the victim has signed in from that particular device.
In plain words: the program's summary says the attacker needed the victim's tdi cookie and UserAgent, and had to send the crafted request within a fixed timeframe after the victim signed in from that device. The httponly part of the cookie description means the cookie is hidden from JavaScript in the page, and secure means the browser only sends it over an encrypted connection. Both are protective settings, but they do not help if the cookie itself is stolen by other means.
Finding it
The researcher's starting point was the observation that, with MFA enabled and valid credentials in hand, the MFA step could be bypassed by changing only some values sent to the login endpoint. The endpoint involved is:
POST auth.grammarly.com//v3/api/login
Line by line: POST is the method, meaning "I am sending data to you". auth.grammarly.com is the server. //v3/api/login is the path to the login counter, version 3 of the API. The report gives the endpoint with a double slash in the summary and with a single slash in the reproduction steps; that small difference is how it appears in the report.
The two fields that mattered were mode and secureLogin. mode tells the server which kind of code is being used, for example a text message (sms) or an email. secureLogin is a true/false switch that tells the server whether the stricter login path is in force. Both are chosen by the browser and sent to the server, which is the heart of the problem: the client was telling the server how strict to be.
Exploitation
Step 1: Enable and configure MFA
Turn on MFA on the account and complete its configuration. This puts the account into the state where a code is normally required after the password. Without this step there is nothing to bypass, so it is the baseline that makes the test meaningful.
Step 2: Log in with email and password
Submit the account's email address and password. The login proceeds to the MFA page. This shows the normal flow: password first, code second.
Step 3: Reach the MFA page
The MFA prompt appears, asking for the code. At this point the browser is about to send the code to the server, and that is the message the researcher wants to catch.
Step 4: Enter any random number
Enter an arbitrary value in the code field. The value does not need to be correct. The point of using a random number is to prove that the code itself plays no part in the success: if the login works with a wrong code, the code was never really checked.
Step 5: Intercept the login request and change two fields
Press the "sign in securely" button and intercept the resulting request:
POST auth.grammarly.com/v3/api/login
Line by line: this is the same login endpoint as before, now with a single slash. The browser is sending the code you typed, plus the fields that describe how the login should be handled, to this address. Intercepting means pausing it in the tool so you can edit it before it leaves your machine.
In the POST message, change the following fields:
"mode":"sms"becomes"mode":"email""secureLogin":truebecomes"secureLogin":false
Why these two changes: the first swaps the kind of code the server thinks it is dealing with, from a text message to an email. The second turns off the stricter login path. Neither change supplies a valid code; they only alter the server's idea of which rules apply. If the server then lets the request through, it means the server was trusting these client-supplied values to decide whether to enforce MFA.
Step 6: Send the modified request
Send the modified request. According to the researcher, the response puts the session into the account: the phone code was never required. A session here means the logged-in state the server grants you, usually represented by a cookie it hands back. Getting that cookie without a valid code is the bypass.
Root cause
The report does not include the server-side code, so the exact mistake is not shown. What the behaviour implies is that the login endpoint trusted client-supplied fields to decide which MFA mode applied and whether the secure login path was in force. Switching mode from sms to email and secureLogin from true to false changed the server's handling of the request so that the MFA check was not enforced, even though the account had MFA enabled and the submitted code was random.
A useful comparison: imagine a form at a building entrance where the visitor writes down "I have already been checked" and the guard believes it. The guard should check for himself; here the server was reading the visitor's own note.
The program's summary adds a device-trust dimension: the bypass worked when the device trust was not expired, and the attacker needed the victim's tdi cookie and UserAgent, within a fixed timeframe after the victim signed in from that device. That points to the server treating a request as coming from a trusted device based on those inputs, and to the mode and secureLogin values influencing whether the MFA requirement was applied on that path. The report does not state how the trust window is measured or how long it lasts.
Impact
The researcher's stated impact is that an attacker who holds the email address and password can log in to the account without the phone code, bypassing the experimental MFA. In other words, the second lock adds nothing against someone who has the first key.
The program's summary narrows this: no users were affected, and the bypass required access to the victim's tdi cookie for that device, knowledge of the victim's UserAgent, and the ability to send the crafted request within a fixed timeframe after the victim signed in from that device. So in practice the attacker also needs to have stolen the device cookie, which is a significant extra hurdle.
Fix
The report does not describe the fix that was applied. What the behaviour calls for is that the server stop deriving the MFA decision from client-controlled mode and secureLogin values, and instead enforce the MFA requirement for the account on the server side regardless of what the client submits. In the building comparison: the guard should check the visitor against his own list, not against the visitor's note.
Variants to test
These are follow-up ideas in the same spirit, useful for anyone learning to look for similar bugs:
- On other login endpoints, change the MFA mode field (for example from an SMS value to an email value) while submitting an invalid code. A positive result is a session that reaches the account without a valid code.
- Flip boolean fields that look like they control the login path, such as
secureLogin, betweentrueandfalse. A positive result is a change in whether the MFA step is enforced. - Replay a login request from a device that has completed MFA, keeping the device cookie and
UserAgent, and vary the mode and boolean fields. A positive result is a successful login without a fresh code. - Test whether the device-trust window can be extended or reused after it should have expired. A positive result is a login that succeeds outside the expected timeframe.
Hunting notes
This kind of bug tends to sit in the request that finalises login, where the client tells the server which authentication path it is on. During recon (the early stage of exploring a target to see what it is made of), watch for login requests that carry fields naming an MFA mode or a boolean that switches a security path, and for device cookies such as tdi combined with UserAgent checks. The signal is a request whose security-relevant values are chosen by the client rather than derived from server-side state.
The researcher demonstrated impact by taking an account with MFA enabled, submitting a random code, changing only the two fields, and showing that the session reached the account. The program's summary notes the conditions under which it was exploitable and that no users were affected.
Glossary
- API: the part of a website that the browser talks to behind the scenes, receiving requests and sending back data.
- Endpoint: one specific address in an API, such as the login address.
- Request: the message a browser sends to a server, with a method, an address and a body of data.
- POST: an HTTP method meaning "I am sending data to the server".
- Field: one named piece of data inside a request body, such as
modeorsecureLogin. - Cookie: a small value the server asks the browser to store and send back on later requests, used to recognise the user.
- Token: a value that stands in for proof of identity, similar in purpose to a cookie.
- Session: the logged-in state the server grants after a successful login, usually tracked by a cookie.
- UserAgent: a short text the browser sends describing itself, such as browser name and operating system.
- MFA (multi-factor authentication): a login that requires more than one proof, typically a password plus a code sent to a phone or email.
- SMS: a text message, one common channel for delivering an MFA code.
- Intercepting a request: pausing a request between browser and server so it can be read and modified, using a tool such as Burp Suite.
- Burp Suite: a tool used by security researchers to capture and edit web traffic.
httponly: a cookie setting that hides the cookie from JavaScript in the page.secure: a cookie setting that makes the browser send the cookie only over an encrypted connection.tdicookie: the device cookie named in the report, used as part of device trust.- Device trust: the server's willingness to treat a request as coming from a device it has already seen and accepted.
- Improper authentication: a vulnerability class where a system accepts a weaker proof of identity than it should, or lets in someone who should not be let in.
- Boolean: a value that is either true or false.
- Recon: the early exploration of a target to understand its structure and features.
- Replay: sending a previously captured request again, possibly with changes.
- Bounty: a payment made by a company to a researcher who reports a valid security issue.
- Severity: a rating of how serious a vulnerability is, here medium.