Skip to content
Business logic Disclosed report Beginner

Improper Input Validation on User's Location on PUT /WhoService/putLocation Could Affect Availability/Falsify Users

The location endpoint accepted latitude and longitude values that are not valid Earth coordinates and stored them without validation. An attacker could submit impossible coordinates to falsify user location data and affect the integrity or availability of analytics.

spaceraccoon Follow

Originally disclosed on HackerOne

  • Triaged in 19 hours
  • Fixed in 31 days
  • Disclosed after 9 months

Summary:

Note: I noticed that that the team has fixed issues like an XSS that's caused only from a header value (typically OOS since it's not directly exploitable) https://github.com/WorldHealthOrganization/app/pull/855, so in the spirit of this I'm also reporting another "good-to-fix" issue.

On the WHO app, users send approximate location data to the WhoService API:

/app/client/flutter/lib/pages/onboarding/location_sharing_page.dart:

  Future<void> _allowLocationSharing() async {
    try {
      await Location().requestPermission();
      if (await Location().hasPermission() == PermissionStatus.granted) {
        if (await Location().requestService()) {
          LocationData location = await Location().getLocation();
          Map jitteredLocationData = JitterLocation().jitter(
              location.latitude, location.longitude,
              5 /*kms refers to kilometers*/);

          await WhoService.putLocation(
              latitude: jitteredLocationData['lat'],
              longitude: jitteredLocationData['lng']);
        }
      }
    } catch(_) {
      // ignore for now.
    } finally {
      _complete();
    }
  }

Which in turn translates to a call to https://staging.whocoronavirus.org/WhoService/putDeviceToken:

curl --request POST \
  --url 'https://hackerone.whocoronavirus.org/WhoService/putLocation' \
  --header 'content-type: application/json' \
  --header 'who-client-id: ██████████' \
  --header 'who-platform: ios' \
  --data '{
	"latitude": 22222222,
	"longitude": "9999999"
}'

This returns a 200 OK response. On the server side, we see that it uses the following logic:

  @Override public Void putLocation(PutLocationRequest request) throws IOException {
    Client client = Client.current();
    client.latitude = request.latitude;
    client.longitude = request.longitude;
    S2LatLng coordinates = S2LatLng.fromDegrees(request.latitude, request.longitude);
    client.location = S2CellId.fromLatLng(coordinates).id();
    ofy().save().entities(client);
    return new Void();
  }

There is no validation on request.latitude, request.longitude before it is stored into the Google App Engine datastore. This is because the S2LatLng.fromDegrees (which transforms the values into a S2LatLng object) from the s2-geometry-library-java library specifically does not validate these values because, according to their comments at https://github.com/google/s2-geometry-library-java/blob/master/src/com/google/common/geometry/S2LatLng.java:

Like the rest of the "geometry" package, the
intent is to represent spherical geometry as a mathematical abstraction, so
functions that are specifically related to the Earth's geometry (e.g.
easting/northing conversions) should be put elsewhere.

Thus, even these values:

	"latitude": 22222222,
	"longitude": "9999999"

Are accepted and stored in the database even though they are technically non-existent coordinates on earth.

To reproduce, just run this request with different who-client-id UUID you generated yourself and impossible latitude and longitude.

curl --request POST \
  --url 'https://hackerone.whocoronavirus.org/WhoService/putLocation' \
  --header 'content-type: application/json' \
  --header 'who-client-id: ████████' \
  --header 'who-platform: ios' \
  --data '{
	"latitude": 22222222,
	"longitude": "9999999"
}'

Impact

An attacker can exploit this to affect the Availability or Integrity of the analytics data by injecting false location values and falsifying user data. A fix for this would be to implement a quick lat lng validator that is specifically meant to validate Earth geometry, instead of the S2LatLng class.

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the server relied on a geometry helper that treats coordinates as abstract maths and does not check they are valid Earth positions, so no range validation was applied before saving.

Impact

An attacker could affect the availability or integrity of analytics data by injecting false locations and falsifying user data.

What the attacker needed

A self-generated client identifier

The fix

The endpoint should validate latitude and longitude against real Earth ranges before storing them.

How it was found

  1. Generate your own client identifier for the app.
  2. Send a location update request to the endpoint with that identifier.
  3. Use latitude and longitude values that cannot exist on Earth.
  4. Observe that the server returns a success response and stores the values.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

The app lets users share their approximate location, and the server saves whatever numbers it receives. It never checks that the numbers describe a real place on Earth, so someone can send nonsense values and pollute the stored data.

What is Business logic?

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

More by spaceraccoon

View all

5 more disclosed reports, best first.

More from WHO COVID-19 Mobile App

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.