Skip to content
Business logic Write-up Intermediate

Here’s how I could’ve ridden for free with Uber

The Uber API accepted an invalid payment method identifier, allowing a user to complete rides without being charged. An attacker could ride for free by supplying random characters as the payment method.

Anand Prakash Follow

Published on medium.freecodecamp.org

Bounty$5,000 View original

This post is about a critical bug on Uber which could have been used by hackers to get unlimited free Uber rides anywhere in the world. This post also explains few best practices while integrating payment gateways.

Anand Prakash (@anandpraka_sh), on medium.freecodecamp.org

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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. 3 min read.

Here’s how I could’ve ridden for free with Uber
Here’s how I could’ve ridden for free with Uber From the original on medium.freecodecamp.org

Context

Uber is an online transportation network company headquartered in San Francisco, California, with operations in 528 cities worldwide. Users create an account on Uber.com and book a ride. When a ride is completed, a user can either pay cash or charge the ride to a credit or debit card.

The feature under examination here is the ride request API, which accepts a payment method identifier alongside the pickup coordinates and the product being booked. The bug reported in this write-up let a rider specify an invalid payment method and still complete rides without being charged.

Setup

The researcher used the ride request endpoint at dial.uber.com. To demonstrate the issue, permission was obtained from the Uber team, and a free ride was taken in India. No special tooling is described beyond the ability to replay the captured request with modified values.

Finding it

By specifying an invalid payment method (for example, abc, xyz, and so on), the researcher was able to ride Uber for free. By specifying an invalid payment method, the researcher was able to ride Uber for free. The ride was free, and no charge followed.

Exploitation

Step 1: Capture the ride request

The vulnerable request is a POST to the dial API, with the payment method identifier set to an arbitrary string:

HTTP
POST /api/dial/v2/requests HTTP/1.1 Host: dial.uber.com {"start_latitude":12.925151699999999,"start_longitude":77.6657536,
 "product_id":"db6779d6-d8da-479f-8ac7–8068f4dade6f","payment_method_id":"xyz"}

The body carries the pickup latitude and longitude, the product_id identifying the ride product, and payment_method_id, which here is the invalid value xyz rather than a real stored payment instrument.

Step 2: Replay with random characters

The researcher replayed the above request with random characters as payment_method_id. The ride was free. The researcher replayed the request with random characters as payment_method_id, and the ride was free.

Root cause

The report does not describe the server-side cause; the takeaways suggest validating payment success and authorisation of identifiers. The report does not describe the server-side code, so the precise validation gap is likely a missing authorisation and existence check on the identifier before the ride is created.

Impact

An attacker could obtain unlimited free Uber rides anywhere in the world, according to the report, by sending an invalid payment method identifier. The researcher demonstrated this with a real ride in India and was not charged for any of the rides using the invalid payment method. The impact depends on the attacker having a valid account able to book rides; the report does not discuss any further constraints.

Fix

Uber fixed the vulnerability quickly. The takeaways list the practices developers should apply when integrating payment gateways:

  1. Verify whether the payment succeeded or failed by making a server-to-server request to the payment gateway, or by verifying a checksum with the payment gateway provider.
  2. Always validate the amount of the item against the amount the user actually paid to the payment gateway.
  3. Validate currency in payment API calls. For example, an attacker could pay 50 IDR for a 50 USD item.
  4. If credit or debit card information is stored, always check authorisation when an identifier is passed in an API request.

Timeline

Date Event
Aug 22nd 2016 Vulnerability report sent to Uber
Aug 26th 2016 Uber requested more information about the bug
Aug 26th 2016 Took a free ride and replied with ride details
Aug 27th 2016 Vulnerability fixed by Uber
Sep 10th 2016 Rewarded with a $5000 bounty by Uber

Variants to test

  • Replace a payment identifier with a random string on other booking or checkout APIs. A positive result is an order or booking that is created and fulfilled without a charge.
  • Substitute another user's payment identifier where one is accepted. A positive result is a charge or booking against an instrument the caller does not own.
  • Send a valid identifier but a mismatched amount or currency. A positive result is fulfilment of an item whose price does not match what was paid.
  • Skip the server-to-server confirmation step by manipulating the client response. A positive result is an order marked paid without a corresponding gateway confirmation.

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. 9 min read.

What happened, in plain words

Uber is a company that lets you book a car ride through its website or app. You create an account, say where you are and where you want to go, and a driver comes to pick you up. When the ride is finished, you pay. You can pay with cash, or you can let Uber charge the ride to a credit or debit card you have saved in your account.

This report is about a mistake in Uber's systems that let a rider book and complete rides without ever being charged. The trick was to tell Uber to use a payment method that does not exist, for example a made-up string of letters like abc or xyz, instead of a real card. Uber accepted the made-up value, created the ride, and never took any money.

The researcher who found it got permission from Uber's security team and then took a real free ride in India to prove the problem was genuine. Uber fixed it on Aug 27th 2016 and paid a $5000 reward, called a bug bounty, for the report.

Here’s how I could’ve ridden for free with Uber
Here’s how I could’ve ridden for free with Uber From the original on medium.freecodecamp.org

The image above is the header of the write-up, titled "Here's how I could've ridden for free with Uber".

A few ideas come up again and again below, so here they are from zero:

  • API: an API is the set of doors a website or app uses to talk to its own servers. When you tap "book" in the Uber app, the app sends a message to an Uber server saying what you want. That message is the API request. Think of it as a waiter taking your order to the kitchen: you never walk into the kitchen yourself, you just tell the waiter what you want.
  • Request: the message the app sends to the server. It has a method (like POST, meaning "here is some data, please create something"), a path (which door on the server), and a body (the data itself).
  • Payment method identifier: a short code that stands for one of your saved cards. Instead of sending your full card number every time, the app sends a code like card_1234 and the server looks up which card that is. Think of a cloakroom ticket: you hand over the ticket, and the attendant fetches the coat that belongs to it.
  • Logic flaw: a bug not in the sense of a crash or a broken screen, but in the sense that the program follows its rules correctly while the rules themselves are wrong. The server did exactly what it was told; it just never checked whether the ticket was real.

The feature being tested

The part of Uber under examination is the ride request API. When you book a ride, the app sends the server three kinds of information: where you are (your pickup coordinates), which kind of ride you want (the product), and which payment method should be charged. When you book a ride, the app sends the server your pickup coordinates, the ride product and the payment method.

By specifying an invalid payment method, the researcher was able to ride Uber for free.

Setting up

The researcher used the ride request endpoint at dial.uber.com. An endpoint is simply one specific address on a server, like one particular counter in a large building. To demonstrate the issue safely and honestly, permission was obtained from the Uber team first, and a free ride was taken in India. No special tools are described beyond the ability to capture a request and send it again with changed values, which is called replaying a request.

Finding it

By specifying an invalid payment method, for example abc, xyz, and so on, the researcher was able to ride Uber for free. The payment method identifier is supplied by the app, meaning the client, the program running on the user's phone. The payment method identifier was set to a value that did not correspond to any real payment instrument. A payment instrument here just means a way to pay, such as a card. The ride was free, and no charge followed.

Exploitation

Step 1: Capture the ride request

The vulnerable request is a POST to the dial API, with the payment method identifier set to an arbitrary string:

HTTP
POST /api/dial/v2/requests HTTP/1.1 Host: dial.uber.com {"start_latitude":12.925151699999999,"start_longitude":77.6657536,
 "product_id":"db6779d6-d8da-479f-8ac7–8068f4dade6f","payment_method_id":"xyz"}

Line by line, in plain words:

  • POST /api/dial/v2/requests HTTP/1.1 is the first line of the request. POST says "I am sending data and asking you to create something". /api/dial/v2/requests is the path, the specific door on the server that handles ride requests. HTTP/1.1 is the version of the language the request is written in.
  • Host: dial.uber.com tells the server which website name the request is for. A single server can answer for many names, so this line says which one.
  • The rest is the body, the actual data. start_latitude and start_longitude are the coordinates of the pickup point, in this case numbers around 12.9 and 77.6, which correspond to a location in India.
  • product_id is a code identifying which kind of ride is being booked. The long string starting db6779d6 is that code.
  • payment_method_id is the important one. Here it is set to xyz, a value that does not stand for any real card. This is the made-up cloakroom ticket.

The whole point of this step is to see what the app normally sends, so that it can be sent again with one value changed. Capturing a request is like writing down the exact words you said to the waiter, so you can say them again later with one word swapped.

Step 2: Replay with random characters

The researcher replayed the above request with random characters as payment_method_id. The ride was free. The researcher replayed the request with random characters as payment_method_id, and the ride was free. In other words, the kitchen accepted an order with a cloakroom ticket that belonged to no coat, and still served the meal.

Root cause

The report does not describe the server-side cause; the takeaways suggest validating payment success and authorisation of identifiers. The report does not describe the server-side code, so the precise validation gap is likely a missing authorisation and existence check on the identifier before the ride is created. An existence check means asking "does this ticket match a real coat?", and an authorisation check means asking "does this coat belong to the person holding the ticket?".

Impact

According to the report, an attacker could obtain unlimited free Uber rides anywhere in the world by sending an invalid payment method identifier. The researcher demonstrated this with a real ride in India and was not charged for any of the rides using the invalid payment method. The impact depends on the attacker having a valid account able to book rides; the report does not discuss any further constraints.

Fix

Uber fixed the vulnerability quickly. The takeaways list the practices developers should apply when integrating payment gateways. A payment gateway is the outside company that actually moves the money, such as a card processor; Uber's own servers talk to it behind the scenes.

  1. Verify whether the payment succeeded or failed by making a server-to-server request to the payment gateway, or by verifying a checksum with the payment gateway provider. A server-to-server request means Uber's server asks the gateway directly, rather than believing what the user's phone says. A checksum is a short code computed from the payment details that only the gateway and the merchant can produce correctly, so it proves the message is genuine.
  2. Always validate the amount of the item against the amount the user actually paid to the payment gateway. If the ride costs one amount and the gateway says a different amount was paid, something is wrong.
  3. Validate currency in payment API calls. For example, an attacker could pay 50 IDR for a 50 USD item. IDR is Indonesian rupiah and USD is US dollars; the numbers match but the money does not.
  4. If credit or debit card information is stored, always check authorisation when an identifier is passed in an API request. In plain words, when someone hands over a ticket, check that the coat behind it is theirs.

Timeline

Date Event
Aug 22nd 2016 Vulnerability report sent to Uber
Aug 26th 2016 Uber requested more information about the bug
Aug 26th 2016 Took a free ride and replied with ride details
Aug 27th 2016 Vulnerability fixed by Uber
Sep 10th 2016 Rewarded with a $5000 bounty by Uber

A bug bounty is a reward a company pays to someone who reports a security problem responsibly, instead of exploiting it or selling it.

Variants to test

These are the same kind of check applied to other places, useful if you are learning to look for similar mistakes:

  • Replace a payment identifier with a random string on other booking or checkout APIs. A positive result is an order or booking that is created and fulfilled without a charge.
  • Substitute another user's payment identifier where one is accepted. A positive result is a charge or booking against an instrument the caller does not own.
  • Send a valid identifier but a mismatched amount or currency. A positive result is fulfilment of an item whose price does not match what was paid.
  • Skip the server-to-server confirmation step by manipulating the client response. A positive result is an order marked paid without a corresponding gateway confirmation.

Glossary

  • API: the set of addresses and rules a website or app uses to talk to its servers, like a waiter carrying orders to the kitchen.
  • Request: a message sent from an app or browser to a server, containing a method, a path and often a body of data.
  • POST: an HTTP method meaning "here is data, please create something".
  • Endpoint: one specific address on a server that handles one kind of request.
  • Body: the part of a request that carries the actual data, such as coordinates and identifiers.
  • Payment method identifier: a short code standing for a saved way to pay, like a cloakroom ticket standing for a coat.
  • Payment instrument: any real way to pay, such as a credit or debit card.
  • Client: the program running on the user's side, such as the phone app or browser.
  • Server: the computer that receives requests and does the real work, such as creating a ride.
  • Logic flaw: a bug where the program follows its rules correctly but the rules themselves are wrong, so it accepts something it should refuse.
  • Replay: sending a captured request again, usually with one value changed, to see how the server reacts.
  • Existence check: asking whether an identifier matches something real.
  • Authorisation check: asking whether the person making the request is allowed to use the thing they are referring to.
  • Payment gateway: the outside company that actually moves money between a customer and a merchant.
  • Server-to-server request: one server asking another server directly, instead of trusting what the user's device reports.
  • Checksum: a short code computed from data that proves the data is genuine and unaltered.
  • Currency: the kind of money used, such as USD or IDR.
  • Bug bounty: a reward a company pays to someone who reports a security problem responsibly.
  • IDR: Indonesian rupiah, the currency of Indonesia.
  • USD: United States dollar, the currency of the United States.

More by Anand Prakash

View all

6 more disclosed reports, best first.

More from Uber

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.