Skip to content
Info disclosure Write-up Intermediate

I was able to see likes count even though it was hidden by the victim | YouTube App 16.15.35

The YouTube app's internal player API returned an averageRating value even when the video owner had hidden the like count. An attacker could use that value together with the visible like count to calculate the hidden number of likes and dislikes.

R ando Follow

Published on bloggerrando.blogspot.com

Name: YouTube Version: 16.15.35 Updated: 20 April 2021 Download: 5.000.000.000+ download

R ando (@Rando02355205), on bloggerrando.blogspot.com

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

Context

YouTube lets a video's owner hide the public like count on their videos. The researcher was interested in YouTube Shorts, which was in beta in the U.S. from 18 March 2021, and was trying it from Indonesia. The target of the report is the YouTube Android app, version 16.15.35 (updated 20 April 2021, listed with 5,000,000,000+ downloads).

The claim in the report is that the like count of a video whose owner had hidden it could still be read through the Shorts beta, and that the dislike count of the same video could then be derived from the averageRating value returned by YouTube's internal player endpoint.

Setup

  • YouTube Android app, version 16.15.35.
  • A victim video whose like count was hidden by its owner.
  • The ability to send a request to YouTube's internal player API and to read the averageRating field in the response.
  • The researcher's own likes and dislikes, used to observe how averageRating moves.

No special role or privileged account is described.

Finding it

While using the Shorts beta, the researcher found that the like count of a video was visible even though the victim had hidden it. The same response also carries averageRating, and the researcher worked out that this value, combined with a known like count, is enough to compute the dislike count.

The report notes that green stands for likes and red for dislikes in the figures it refers to.

Exploitation

Step 1: request the player data

The researcher sends a POST request to the internal player endpoint, with the video identifier in the body:

HTTP
[POST] https://www.youtube.com/youtubei/v1/player?key=...

"videoId":"videoId"

The key query parameter is shown as ..., and videoId selects the video. The response contains averageRating, which is the field the whole technique depends on.

Step 2: learn how averageRating behaves

By liking and disliking the victim video and observing the result, the researcher recorded the following mapping:

Text
"averageRating":

1 like(s) / 0 dislike(s) = averageRating: 5 (without dislike) %100
2 like(s) / 0 dislike(s) = averageRating: 5 (without dislike) %100
3 like(s) / 0 dislike(s) = averageRating: 5 (without dislike) %100

1 like(s) / 1 dislike(s) = averageRating: 3 (like and dislike is the same) %50
2 like(s) / 2 dislike(s) = averageRating: 3 (like and dislike is the same) %50
3 like(s) / 3 dislike(s) = averageRating: 3 (like and dislike is the same) %50

0 like(s) / 1 dislike(s) = averageRating: 1 (without like) %0
0 like(s) / 2 dislike(s) = averageRating: 1 (without like) %0
0 like(s) / 3 dislike(s) = averageRating: 1 (without like) %0

So averageRating runs from 1 to 5, where 5 means no dislikes, 3 means likes and dislikes are equal, and 1 means no likes. The researcher also gives the scale in percentage terms:

Text
averageRating | Percentage

5.000      |      100.0%     (4.000)
4.000      |      75.00%     (3.000)
3.000      |      50.00%     (2.000)
2.000      |      25.00%     (1.000)
1.100      |      2.50%     (0.100)
1.010      |      0.25%     (0.010)
1.001      |      0.025%     (0.001)
1.000      |      0%     (0.000)

Step 3: derive the dislike count

The researcher's example: the victim video has 100 likes and 100 dislikes, so averageRating is 3. With the like count known, the dislike count follows from the formula:

Text
averageRating = 3
Like(s) = 100

100 likes*(5-averageRating)/(averageRating-1)
100*(5-3)/(3-1)
100*(2)/(2) = 100 dislikes

Step 4: handle the no-like case

If the video has no likes, the percentage is 0% and averageRating is 1, so the formula cannot be applied. The researcher suggests clicking like on the video so that the percentage is no longer 0% and averageRating is no longer 1. The report states plainly that the dislike count cannot be determined if the video has no likes.

Step 5: the calculator

The researcher published a small PHP page that takes averageRating and the like count and prints both counts:

PHP
<?php error_reporting(E_ALL & ~E_NOTICE); ?>

<?php

$averageRating=$_POST['averageRating'];
$like=$_POST['like'];

if ($averageRating <= 1)
{
 $like=0;
}

if (($averageRating > 1 AND $averageRating <= 5) AND $like >= 1)
{
 $percentage=($averageRating-1)*25;
 $percentageDislike=100-$percentage;
 $dislike=($like*(5-$averageRating))/($averageRating-1);
}
else
{
 $percentage=0;
 $percentageDislike=0;
 $dislike=0;
}

?>

<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post'>
 averageRating: <input type='text' name='averageRating' value='<?php echo $averageRating; ?>'>
 <br>
 Like(s): <input type='text' name='like' value='<?php echo $like; ?>'>
 <input type='submit'>
</form>

<?php echo "<font color='green'> Like(s) ๐Ÿ‘ $like</font> ($percentage%) | <font color='red'>Dislike(s) ๐Ÿ‘Ž $dislike</font> ($percentageDislike%)" ?>

The percentage of likes is (averageRating - 1) * 25, the dislike percentage is its complement, and the dislike count is like * (5 - averageRating) / (averageRating - 1). When averageRating is 1 or below, the script forces the like count to 0 and reports zeros.

A proof-of-concept video accompanies the write-up:

Or watch on YouTube
From the original on bloggerrando.blogspot.com

Root cause

The player response exposes averageRating, a single aggregate that encodes the ratio between likes and dislikes. Hiding the like count therefore does not hide the underlying rating data. Because the ratio is published and the like count is known, the dislike count can be solved for algebraically. The report does not describe the server-side code or any check that was supposed to prevent this; the weakness is classified as a logic flaw.

Impact

An attacker can read the like count of a video whose owner has hidden it, and from that and averageRating can compute the dislike count. This works when the like count is known and the video has at least one like; with no likes, averageRating is 1 and the dislike count cannot be determined. The report does not state who else is affected beyond the video owner whose counts were meant to be private.

Fix

The report's timeline records the fix on 05/11/2022.

Timeline

Date Event
04/21/2021 Bug found
04/21/2021 Report submitted
04/21/2021 Triaged, priority P4 to P2, status New to Assigned
04/26/2021 Accepted, status Assigned to Accepted, severity S4 to S2, type Customer Issue to Bug
05/05/2021 Bounty awarded by Google
05/11/2022 Fixed

Variants to test

  1. Other aggregate fields. Look for responses that expose a ratio or score derived from hidden counters (ratings, votes, reactions) on other platforms. A positive result is a value that changes when you add your own vote and lets you solve for the hidden counter.
  2. Alternative clients. Query the same content through a beta client, a mobile API or an embedded player and compare the fields returned. A positive result is a client that returns the hidden count or the aggregate where the main web client does not.
  3. Hidden-count toggles. On any service with a privacy toggle for counts, check whether the toggle only affects rendering while the API still returns the number. A positive result is the hidden value appearing in a JSON response.
  4. Ratio arithmetic. For any endpoint returning an average or percentage, test whether two known inputs (for example, your own like and dislike) pin down the scale, then apply the same algebra to recover the unknown side. A positive result is a computed count that matches the true count on a test video you control.

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

What happened, in plain words

YouTube lets the owner of a video hide the public like count. The idea is that viewers should not be able to see how many people liked the video. The researcher found that this hidden number could still be read through YouTube Shorts, a short-video feature that YouTube was testing in the United States from 18 March 2021. The researcher was trying Shorts from Indonesia.

The report is about the YouTube Android app, version 16.15.35, updated on 20 April 2021, listed with 5,000,000,000+ downloads.

There is a second part to the finding. YouTube's internal player service returns a number called averageRating. That single number describes the balance between likes and dislikes on a video. If you already know the like count, you can use averageRating to work out the dislike count with a bit of arithmetic. So the report covers two things: reading a like count that was meant to be hidden, and then calculating the dislike count from it.

To follow the rest of this article you only need to understand a few ideas, explained as they come up.

Background ideas

What an API is. A website like YouTube is not one single program. The app you see on your phone talks to computers at YouTube, and those computers send back data. The address the app talks to is called an API (application programming interface). Think of it as a service counter: you hand over a request with a few details, and the counter hands back a structured answer. The answer is usually in a format called JSON, which is just text arranged as labels and values, for example "averageRating": 3.

What a request is. When your app asks the counter for something, it sends a request. A request has a method (such as POST, meaning "here is some data for you"), an address (a URL), and often a body, which is the data being sent. The report shows one such request.

What an API key is. The key=... part of the address is shown shortened in the report. The report shows it as ... rather than the real value.

What a video ID is. Every YouTube video has a short identifier, its videoId. It is how the service knows which video you mean, the same way a parcel needs a tracking number.

What averageRating is. This is a score from 1 to 5 that YouTube's player service returns for a video. It is not a star rating left by viewers. It is a summary of the like and dislike balance, and the whole technique in this report depends on it.

What the vulnerability class means. The report classifies the weakness as a logic flaw. That means the code does what it was written to do, but the design allows something the designers did not intend. Nothing crashes and no password is stolen. The service simply hands back a number that, combined with other information, reveals something that was supposed to stay private.

Setup

The researcher worked with:

  • The YouTube Android app, version 16.15.35.
  • A victim video whose like count the owner had hidden.
  • The ability to send a request to YouTube's internal player API and to read the averageRating field in the answer.
  • The researcher's own likes and dislikes, used to watch how averageRating changes.

No special account or staff role is described.

Finding it

While using the Shorts beta, the researcher noticed that the like count of a video was visible even though the owner had hidden it. The same answer from the service also contains averageRating. The researcher worked out that this value, together with a known like count, is enough to calculate the dislike count.

In the figures the report refers to, green stands for likes and red for dislikes.

Exploitation

Step 1: request the player data

The researcher sends a POST request to the internal player address, with the video identifier in the body:

HTTP
[POST] https://www.youtube.com/youtubei/v1/player?key=...

"videoId":"videoId"

Line by line:

  • [POST] is the method. POST means the request carries data in its body, here the video identifier.
  • https://www.youtube.com/youtubei/v1/player is the address of YouTube's internal player service. This is the counter the app talks to when it needs information about a video.
  • ?key=... is the API key, shown shortened. It identifies the client making the request.
  • The blank line separates the address from the body.
  • "videoId":"videoId" is the body: a label and a value in JSON style. The real value would be the identifier of the chosen video.

The answer to this request contains averageRating, the field the whole technique depends on. This step was taken because that field is the only piece of information the calculation needs beyond the like count.

Step 2: learn how averageRating behaves

To understand what the number means, the researcher liked and disliked the victim video and recorded what came back:

Text
"averageRating":

1 like(s) / 0 dislike(s) = averageRating: 5 (without dislike) %100
2 like(s) / 0 dislike(s) = averageRating: 5 (without dislike) %100
3 like(s) / 0 dislike(s) = averageRating: 5 (without dislike) %100

1 like(s) / 1 dislike(s) = averageRating: 3 (like and dislike is the same) %50
2 like(s) / 2 dislike(s) = averageRating: 3 (like and dislike is the same) %50
3 like(s) / 3 dislike(s) = averageRating: 3 (like and dislike is the same) %50

0 like(s) / 1 dislike(s) = averageRating: 1 (without like) %0
0 like(s) / 2 dislike(s) = averageRating: 1 (without like) %0
0 like(s) / 3 dislike(s) = averageRating: 1 (without like) %0

What this shows:

  • When there are likes and no dislikes, averageRating is 5, which is 100 percent.
  • When likes and dislikes are equal, averageRating is 3, which is 50 percent.
  • When there are dislikes and no likes, averageRating is 1, which is 0 percent.

So the number runs from 1 to 5. It is a scale of how favourable the reactions are, not a raw count. The researcher also gives the scale in percentage terms:

Text
averageRating | Percentage

5.000      |      100.0%     (4.000)
4.000      |      75.00%     (3.000)
3.000      |      50.00%     (2.000)
2.000      |      25.00%     (1.000)
1.100      |      2.50%     (0.100)
1.010      |      0.25%     (0.010)
1.001      |      0.025%     (0.001)
1.000      |      0%     (0.000)

This table maps each averageRating value to a percentage. The number in brackets is the same percentage written as a fraction of one. The table maps each averageRating value to a percentage, with the number in brackets written as a fraction of one.

Step 3: derive the dislike count

The researcher's example: the victim video has 100 likes and 100 dislikes, so averageRating is 3. With the like count known, the dislike count follows from the formula:

Text
averageRating = 3
Like(s) = 100

100 likes*(5-averageRating)/(averageRating-1)
100*(5-3)/(3-1)
100*(2)/(2) = 100 dislikes

Line by line:

  • averageRating = 3 and Like(s) = 100 are the two known values: the score from the player service and the like count.
  • 100 likes*(5-averageRating)/(averageRating-1) is the formula. It takes the like count and multiplies it by (5 - averageRating) divided by (averageRating - 1).
  • 100*(5-3)/(3-1) fills in the numbers: 5 - 3 is 2, and 3 - 1 is 2.
  • 100*(2)/(2) = 100 dislikes is the result: 100 multiplied by 2 divided by 2, which is 100.

The logic behind the formula is a ratio. averageRating tells you how likes and dislikes compare. If the score is 3, they are equal, so the dislike count equals the like count. If the score is higher, dislikes are fewer; if lower, dislikes are more. The formula turns that comparison into a number.

Step 4: handle the no-like case

If the video has no likes, the percentage is 0 percent and averageRating is 1. The formula divides by averageRating - 1, which would be zero, and division by zero is not possible. The researcher suggests clicking like on the video so that the percentage is no longer 0 percent and averageRating is no longer 1. The report states plainly that the dislike count cannot be determined if the video has no likes.

Step 5: the calculator

The researcher published a small PHP page that takes averageRating and the like count and prints both counts. PHP is a programming language commonly used for web pages; this page is a simple form that does the arithmetic for you.

PHP
<?php error_reporting(E_ALL & ~E_NOTICE); ?>

<?php

$averageRating=$_POST['averageRating'];
$like=$_POST['like'];

if ($averageRating <= 1)
{
 $like=0;
}

if (($averageRating > 1 AND $averageRating <= 5) AND $like >= 1)
{
 $percentage=($averageRating-1)*25;
 $percentageDislike=100-$percentage;
 $dislike=($like*(5-$averageRating))/($averageRating-1);
}
else
{
 $percentage=0;
 $percentageDislike=0;
 $dislike=0;
}

?>

<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post'>
 averageRating: <input type='text' name='averageRating' value='<?php echo $averageRating; ?>'>
 <br>
 Like(s): <input type='text' name='like' value='<?php echo $like; ?>'>
 <input type='submit'>
</form>

<?php echo "<font color='green'> Like(s) ๐Ÿ‘ $like</font> ($percentage%) | <font color='red'>Dislike(s) ๐Ÿ‘Ž $dislike</font> ($percentageDislike%)" ?>

Line by line:

  • <?php error_reporting(E_ALL & ~E_NOTICE); ?> turns on error reporting but hides notices, small warnings that would otherwise clutter the page.
  • $averageRating=$_POST['averageRating']; reads the value the user typed into the averageRating field of the form. $_POST is how PHP receives data sent with a POST request.
  • $like=$_POST['like']; reads the like count the user typed in the same way.
  • if ($averageRating <= 1) { $like=0; } handles the no-like case: if the score is 1 or below, the like count is forced to 0.
  • if (($averageRating > 1 AND $averageRating <= 5) AND $like >= 1) is the main branch, used when the score is between 1 and 5 and there is at least one like.
  • $percentage=($averageRating-1)*25; converts the score to a like percentage. A score of 3 gives (3-1)*25, which is 50 percent.
  • $percentageDislike=100-$percentage; gives the dislike percentage as the remainder.
  • $dislike=($like*(5-$averageRating))/($averageRating-1); is the same formula as in Step 3, written in PHP.
  • The else branch sets all three values to 0 when the inputs do not fit the main case.
  • The <form> block builds the page: two text boxes, one for averageRating and one for the like count, and a submit button. $_SERVER['PHP_SELF'] makes the form send its data back to the same page.
  • The final echo prints the results: likes in green with their percentage, dislikes in red with theirs.

A proof-of-concept video accompanies the write-up:

Or watch on YouTube
From the original on bloggerrando.blogspot.com

Root cause

The player answer exposes averageRating, a single combined number that encodes the ratio between likes and dislikes. Hiding the like count therefore does not hide the underlying rating data. Because the ratio is published and the like count is known, the dislike count can be solved for with algebra. The report does not describe the server-side code or any check that was supposed to prevent this; the weakness is classified as a logic flaw.

Impact

An attacker can read the like count of a video whose owner has hidden it, and from that and averageRating can compute the dislike count. This works when the like count is known and the video has at least one like; with no likes, averageRating is 1 and the dislike count cannot be determined. The report does not state who else is affected beyond the video owner whose counts were meant to be private.

Fix

The report's timeline records the fix on 05/11/2022.

Timeline

Date Event
04/21/2021 Bug found
04/21/2021 Report submitted
04/21/2021 Triaged, priority P4 to P2, status New to Assigned
04/26/2021 Accepted, status Assigned to Accepted, severity S4 to S2, type Customer Issue to Bug
05/05/2021 Bounty awarded by Google
05/11/2022 Fixed

Variants to test

  1. Other aggregate fields. Look for answers that expose a ratio or score derived from hidden counters (ratings, votes, reactions) on other platforms. A positive result is a value that changes when you add your own vote and lets you solve for the hidden counter.
  2. Alternative clients. Query the same content through a beta client, a mobile API or an embedded player and compare the fields returned. A positive result is a client that returns the hidden count or the aggregate where the main web client does not.
  3. Hidden-count toggles. On any service with a privacy toggle for counts, check whether the toggle only affects what is drawn on screen while the API still returns the number. A positive result is the hidden value appearing in a JSON answer.
  4. Ratio arithmetic. For any endpoint returning an average or percentage, test whether two known inputs (for example, your own like and dislike) pin down the scale, then apply the same algebra to recover the unknown side. A positive result is a computed count that matches the true count on a test video you control.

Glossary

  • API: the address and rules a program uses to ask another service for data, like a service counter for software.
  • API key: a string that identifies which application is making a request, shown as ... in this report.
  • averageRating: a score from 1 to 5 returned by YouTube's player service that summarises the balance of likes and dislikes on a video.
  • Body: the part of a request that carries data, here the video identifier.
  • JSON: a text format for data arranged as labels and values, such as "averageRating": 3.
  • Like count: the number of people who liked a video, which the owner can choose to hide.
  • Logic flaw: a weakness where the code works as written but the design allows something unintended, such as revealing a hidden number.
  • PHP: a programming language often used to build web pages and forms.
  • POST: a request method that sends data in the body, used here to ask the player service about a video.
  • Proof of concept (PoC): a demonstration, here a video, showing the issue actually happening.
  • Request: a message an app sends to a service asking for something or sending data.
  • Response: the answer a service sends back to a request.
  • Shorts: YouTube's short-video feature, in beta in the U.S. from 18 March 2021, through which the hidden like count was visible.
  • Triaged: the stage where a bug report is reviewed and given a priority and status.
  • videoId: the short identifier that tells YouTube which video a request is about.
  • Vulnerability: a weakness in a system that allows something the designers did not intend.

More by R ando

View all

11 more disclosed reports, best first.

More from Google (Youtube)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.