Skip to content
CSRF Disclosed report Beginner

Отвязываем Twitter от любого профиля вк ! + несколько багов по дизайну

The endpoint for setting a Twitter OAuth binding lacked a CSRF token, so an attacker could make a request that changes the linked Twitter account on any profile. The report also mentions several design bugs but gives no details.

pisarenko Follow

Originally disclosed on HackerOne

Bounty$250 View original
  • Fixed in 9 days
  • Paid in 9 days
  • Disclosed after 10 months

Summary by the program

Отсутствовал csrf-token для /edit?act=set_twitter_oauth, что позволяло запросом изменять привязанный твиттер аккаунт. http://vk.com/edit?act=set_twitter_oauth&oauth_token=XXX&oauth_verifier=XXX

Summary by the researcher

███████████████████████████ ███████▀▀▀░░░░░░░▀▀▀███████ ████▀░░░░░░░░░░░░░░░░░▀████ ███│░░░░░░░░░░░░░░░░░░░│███ ██▌│░░░░░░░░░░░░░░░░░░░│▐██ ██░└┐░░░░░░░░░░░░░░░░░┌┘░██ ██░░└┐░░░░░░░░░░░░░░░┌┘░░██ ██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██ ██▌░│██████▌░░░▐██████│░▐██ ███░│▐███▀▀░░▄░░▀▀███▌│░███ ██▀─┘░░░░░░░▐█▌░░░░░░░└─▀██ ██▄░░░▄▄▄▓░░▀█▀░░▓▄▄▄░░░▄██ ████▄─┘██▌░░░░░░░▐██└─▄████ █████░░▐█─┬┬┬┬┬┬┬─█▌░░█████ ████▌░░░▀┬┼┼┼┼┼┼┼┬▀░░░▐████ █████▄░░░└┴┴┴┴┴┴┴┘░░░▄█████ ███████▄░░░░░░░░░░░▄███████ ██████████▄▄▄▄▄▄▄██████████ ███████████████████████████

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

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 3 min read.

What the report shows

The target is VK.com, and the feature in question is the account settings page that links a Twitter account to a VK profile. The endpoint involved is /edit?act=set_twitter_oauth, which accepts an OAuth token and verifier and stores the resulting Twitter binding on the profile.

The program's summary states the problem plainly: the endpoint had no CSRF token, so a request could change the linked Twitter account. The request shape given is:

HTTP
http://vk.com/edit?act=set_twitter_oauth&oauth_token=XXX&oauth_verifier=XXX

The researcher's own summary is a piece of ASCII art rather than prose, so the technical detail comes from the program's summary. The report does not describe the exact steps taken to deliver the request, the victim's state before and after, or any proof beyond the endpoint and its missing token. It also does not give a severity rating or CVSS score.

The outcome recorded is a bounty of 250.00 USD, a weakness classification of Cross-Site Request Forgery (CSRF), and disclosure on 2016-04-04. The report does not state which change was made to fix it.

Root cause

The endpoint took its parameters in the query string and did not require an anti-CSRF token tied to the user's session. Because the OAuth token and verifier travel as ordinary parameters, a request to that URL could change the binding for the logged-in account.

Impact

A request to the endpoint could change which Twitter account is linked to a logged-in user's profile. The report frames the impact as the ability to modify the bound Twitter account by request.

How this kind of bug works

CSRF abuses the fact that browsers attach a user's cookies to requests automatically, regardless of which site caused the request. If a state-changing endpoint authenticates purely by session cookie and has no other way to tell a genuine in-app action from a forged one, then any third-party page can trigger it. The classic defences are a per-session or per-request token that the attacker cannot read (because of the same-origin policy), strict checking of Origin or Referer, SameSite cookie attributes, and avoiding state changes on GET. OAuth callback endpoints are a frequent weak spot because they are designed to be reached by redirect from a third party, which makes developers reluctant to add token checks.

How to test for it

  1. Map state-changing endpoints: profile edits, email and phone changes, linked-account bindings, OAuth callbacks, password changes, API key creation. Look for GET requests that carry parameters and change something.
  2. Capture a genuine request in a proxy, then replay it without the anti-CSRF token, with a token from a different session, and with the token removed from both body and headers. A request that still succeeds is a candidate.
  3. Rebuild the request as a cross-site form or image load in a test page and load it while authenticated as a second account. A positive result is a visible state change on the victim account with no interaction beyond visiting the page.
  4. For OAuth callbacks, complete the flow once to learn the parameter names, then check whether the callback can be replayed with a different token and verifier without any session-bound value.

Common false positives: endpoints that require a custom header the browser will not send cross-origin, endpoints protected by SameSite=Strict cookies, actions that only affect the attacker's own account, and requests that appear to succeed but are silently rejected server-side. Always confirm the change by reloading the victim's settings.

How it is fixed

Require a per-session anti-CSRF token on the endpoint and reject requests without a valid one. Prefer POST for state changes and reject GET. Validate Origin or Referer against the expected host. Set SameSite on session cookies. For OAuth callbacks, bind the flow to the session with a state value generated at the start of the flow and verified on return.

Hunting notes

Linked-account and OAuth callback endpoints are prime candidates because they are reached by redirect and often skip token checks. Recon signals include settings pages with act= style parameters, endpoints that accept oauth_token and oauth_verifier, and any GET request that changes stored state. To get a report accepted, show the before and after state of a second account, keep the proof minimal, and state clearly what the attacker controls and what the victim loses.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 6 min read.

What happened, in plain words

VK.com is a social network. One of its features lets you connect your VK profile to a Twitter account, so the two are linked. This report is about the page that saves that link.

The page lives at a web address ending in /edit?act=set_twitter_oauth. The request carries two values, an oauth_token and an oauth_verifier. VK then stores the link on your profile. The request that does this looks like this:

HTTP
http://vk.com/edit?act=set_twitter_oauth&oauth_token=XXX&oauth_verifier=XXX

Line by line: http://vk.com/edit is the settings page. Everything after the ? is data sent along with the request. act=set_twitter_oauth tells VK which action to perform, here "set the Twitter link". oauth_token and oauth_verifier are the two values Twitter handed back. The & separates the parameters, and XXX stands for the real values.

The problem, as the program's summary puts it, is that this request had no CSRF token. A CSRF token is a secret, random value that a website puts into its own forms and checks when the form is submitted. It proves the request came from the site's own page and not from somewhere else. Without it, VK could not tell a genuine request from a forged one.

To understand why that matters, think about how cookies work. When you log in to a site, the site gives your browser a cookie, a small piece of data that the browser stores and sends back with every request to that site. That is how the site remembers you are logged in. The catch is that the browser sends the cookie no matter who caused the request. If you are logged in to VK and then open some other page, that page can make your browser send a request to VK, and your VK cookie goes along with it. VK sees a logged-in user and acts.

So a request to the crafted URL could change the linked Twitter account of a logged-in VK user. The report calls this Cross-Site Request Forgery, or CSRF: a request forged from another site, riding on the victim's existing login.

The researcher's own summary is a piece of ASCII art rather than an explanation, so the technical detail comes from the program's summary. The report does not describe the exact steps used to deliver the request, what the victim's profile looked like before and after, or any proof beyond the endpoint and its missing token. It also gives no severity rating or CVSS score.

What is recorded is a bounty of 250.00 USD, the weakness class Cross-Site Request Forgery (CSRF), and disclosure on 2016-04-04. The report does not say what change was made to fix it.

In general, how this kind of bug works

CSRF abuses the automatic way browsers attach cookies to requests. If a page that changes something on your account is protected only by your session cookie, and nothing else distinguishes a real action from a forged one, then any other website can trigger that action for you. The usual defences are:

  1. A per-session or per-request token that the attacker cannot read, because the browser's same-origin policy stops one site from reading another site's pages.
  2. Strict checking of the Origin or Referer header, which says where a request came from.
  3. SameSite cookie attributes, which tell the browser not to send the cookie on requests started by other sites.
  4. Avoiding state changes on GET requests, since a GET can be triggered by something as simple as an image tag.

OAuth callback endpoints are a frequent weak spot. They are designed to be reached by a redirect from a third party, which makes developers reluctant to add token checks.

In general, how to test for it

  1. Map the endpoints that change something: profile edits, email and phone changes, linked-account bindings, OAuth callbacks, password changes, API key creation. Look for GET requests that carry parameters and change stored data.
  2. Capture a genuine request in a proxy, a tool that sits between your browser and the site and lets you read and edit traffic. Then replay it without the anti-CSRF token, with a token from a different session, and with the token removed from both body and headers. A request that still succeeds is a candidate.
  3. Rebuild the request as a cross-site form or image load in a test page, and load it while logged in as a second account. A positive result is a visible change on the victim account with no interaction beyond visiting the page.
  4. For OAuth callbacks, complete the flow once to learn the parameter names, then check whether the callback can be replayed with a different token and verifier without any session-bound value.

Common false positives: endpoints that require a custom header the browser will not send cross-origin, endpoints protected by SameSite=Strict cookies, actions that only affect the attacker's own account, and requests that appear to succeed but are silently rejected on the server. Always confirm the change by reloading the victim's settings.

In general, how it is fixed

Require a per-session anti-CSRF token on the endpoint and reject requests without a valid one. Prefer POST for state changes and reject GET. Validate Origin or Referer against the expected host. Set SameSite on session cookies. For OAuth callbacks, bind the flow to the session with a state value generated at the start of the flow and verified on return.

In general, where to hunt

Linked-account and OAuth callback endpoints are prime candidates because they are reached by redirect and often skip token checks. Recon signals include settings pages with act= style parameters, endpoints that accept oauth_token and oauth_verifier, and any GET request that changes stored state. To get a report accepted, show the before and after state of a second account, keep the proof minimal, and state clearly what the attacker controls and what the victim loses.

Glossary

  • CSRF (Cross-Site Request Forgery): a trick where another website makes your browser send a request to a site you are logged in to, so the site treats it as your action.
  • CSRF token: a secret random value placed in a site's own forms and checked on submission, proving the request came from the site itself.
  • Cookie: a small piece of data a site stores in your browser and gets back with each request, used to remember that you are logged in.
  • Session: the period during which a site recognises you as logged in, usually tied to a cookie.
  • Endpoint: a specific web address on a site that performs a particular action.
  • Parameter: a named value sent with a request, such as act=set_twitter_oauth.
  • Query string: the part of a URL after the ?, holding parameters separated by &.
  • GET request: a request that asks for a page or resource, with data in the URL; easy to trigger from another site.
  • POST request: a request that sends data in its body, typically used for actions that change something.
  • OAuth: a system that lets one site connect to another account without sharing your password, using tokens.
  • OAuth token and verifier: the two values Twitter hands back to VK so VK can complete the connection.
  • Same-origin policy: a browser rule that stops one website from reading the content of another.
  • Origin / Referer header: request headers that tell the server which site the request came from.
  • SameSite cookie attribute: a setting that controls whether a cookie is sent on requests started by other sites.
  • Proxy: a tool between your browser and a site that lets you inspect and modify requests.
  • False positive: a result that looks like a bug but is not one.
  • Bounty: a payment a company makes for a valid security report.
  • CVSS: a standard scoring system for the severity of a vulnerability.

More by pisarenko

View all

29 more disclosed reports, best first.

More from VK.com

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.