Skip to content
Business logic Write-up Intermediate

ProtoBuffer ReUtilization “New Way to Security Test GoogleCaptcha”

The reCAPTCHA implementation only checked the captcha response once and did not verify it again on subsequent submissions, allowing an attacker to reuse a captured protobuffer response to bypass the captcha and submit unlimited form requests.

ChooK Follow

Published on medium.com

While reviewing this bug I began to investigate how to develop a script that could automatically obtain the licenses and apply them locally to the Metasploit Professional installation.

ChooK, on medium.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. 5 min read.

Context

This write-up describes a CAPTCHA bypass found in a Google reCAPTCHA v2 Invisible implementation, demonstrated against a form on a Rapid7 web property. The researcher, ChooK, had previously found a way to obtain unlimited Metasploit Pro licences through a bug in the Rapid7 web application, and while investigating how to automate that process he turned to the reCAPTCHA implementation in front of the form. The result is a technique he calls ProtoBuffer ReUtilization: reusing parts of the Protocol Buffer traffic that carries the reCAPTCHA response in order to break the integrity and purpose of the CAPTCHA.

The report says the attack applies to Google reCAPTCHA v2 Invisible. It is an implementation flaw rather than a flaw in the CAPTCHA challenge itself: once the behaviour of a form submission has been verified, it is not checked again, so the process can be automated.

Background: Protocol Buffers and reCAPTCHA

The report quotes Google's own description of Protocol Buffers:

"Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data, think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages."

In the researcher's words, it is a metalanguage Google uses to parse and process data that must be serialised, keeping it private and confidential between client and server. For this attack, the relevant point is that the reCAPTCHA exchange between the browser and Google is carried in this binary format, and that parts of it can be reused.

To implement reCAPTCHA on a form, the site owner needs a reCAPTCHA Enterprise licence key and then sets up a series of processes through the REST API or RPC as required. The report points to the reCAPTCHA Enterprise documentation and to the public interface definitions in the googleapis/googleapis repository, specifically google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto, as the reference for how the communication over Protocol Buffer is defined.

GitHub ScrenShot about ProtocolBuffer in GRecaptcha From the original on medium.com

The screenshot shows the Protocol Buffer material for reCAPTCHA in the Google APIs repository.

To make the flow clearer, the researcher drew a diagram of what happens under the hood of a reCAPTCHA implementation when a form is filled in and sent.

G.Recaptcha User Interaction Flow
G.Recaptcha User Interaction Flow From the original on medium.com

The diagram shows the user interaction flow with G. reCAPTCHA during a form submission.

Setup

The testing was done manually, with Burp Suite Professional as the intercepting proxy. The target was a form on a Rapid7 property, used with permission from Rapid7 as a testing laboratory. The researcher notes that random data can be used to fill the form, and that a temporary mail service (Tempmail) is an option for the email field. No account, role or special privilege is described beyond being able to load and submit the public form.

Finding it

The researcher's investigation led him to an implementation flaw: once the behaviour when submitting a form is verified, it is not checked again. That means the verification step can be abused by automating the process, which breaks the integrity and objective of the CAPTCHA. The report demonstrates the manual way to review the bug and explains why and how it can be automated.

Exploitation

Step 1: Confirm the form is protected

The first step is to fill the form with random data and observe that the site is indeed protected with reCAPTCHA.

Live PoC Flow #1 From the original on medium.com

The screenshot is labelled Live PoC Flow #1.

Step 2: Read the site key from the page source

In the source code of the page, the data-sitekey attribute for the G-reCAPTCHA can be seen.

Live PoC Flow #2 From the original on medium.com

The screenshot is labelled Live PoC Flow #2.

The G-reCAPTCHA logo is also visible on the website itself.

Live PoC Flow #3 From the original on medium.com

The screenshot is labelled Live PoC Flow #3.

Step 3: Capture the Protocol Buffer request

After submitting the form, a request using the x-protobuffer content type appears in the Burp Suite Professional proxy.

Live PoC Flow #4 From the original on medium.com

The screenshot is labelled Live PoC Flow #4.

Step 4: Replay the request and observe the response

In Burp Repeater, every time this request is sent, a rresp parameter comes back in the response, again in x-protobuffer format.

Live PoC Flow #5 From the original on medium.com

The screenshot is labelled Live PoC Flow #5.

This is the final sent form:

Live PoC Flow #6 From the original on medium.com

The screenshot is labelled Live PoC Flow #6.

Step 5: Reuse the captured request to generate responses

With the previously captured X-Protobuffer reload request, the researcher generates unlimited G-captchaResponse values and sends massive form requests.

Live PoC Flow #7 GIF ProtoBuff Reutilization From the original on medium.com

The GIF is labelled Live PoC Flow #7 GIF ProtoBuff Reutilization.

The result, in the researcher's words: CAPTCHA Defeated.

From the original on medium.com

Root cause

The report describes the flaw as an implementation issue: once the behaviour when submitting a form is verified, it is not checked again. Because the reload request can be replayed to obtain an rresp each time, an attacker who captures it can generate G-captchaResponse values and drive bulk submissions. The report does not go into the server-side code that performs the check; the observable behaviour is that replaying the captured request keeps producing an rresp.

Impact

Under the conditions shown, an attacker can defeat the CAPTCHA on a form protected by reCAPTCHA v2 Invisible and submit the form in bulk, which removes the protection the CAPTCHA is meant to provide against automated abuse. The demonstration was carried out against a Rapid7 form with Rapid7's permission. The report does not quantify the volume of submissions achieved or describe any other effect on the target.

Timeline

  1. 17/10/21: bug found and tested in custom environments.
  2. 18/10/21: reported to Rapid7.
  3. 20/10/21: Rapid7 confirmed the bug.

The researcher states that a tool is coming soon. The report does not describe any fix applied by the vendor.

Variants to test

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

A security researcher called ChooK found a way to defeat a Google reCAPTCHA on a form belonging to Rapid7, a security company. reCAPTCHA is the little box, or the invisible check, that websites use to tell humans apart from automated programs (bots). The whole point of it is to stop a script from filling in a form thousands of times. ChooK found that on this particular form, a captured Protocol Buffer request could be replayed to keep producing CAPTCHA response values, so a script could submit the form in bulk.

He calls the technique ProtoBuffer ReUtilization. The name comes from Protocol Buffers, a compact data format that Google uses to send the reCAPTCHA answer back and forth. The trick is to grab one of those messages and replay it to keep producing rresp values.

The report is careful about scope: the attack works against Google reCAPTCHA v2 Invisible, and it is a flaw in how the site wired the CAPTCHA up, not a flaw in the CAPTCHA challenge itself. In the researcher's words, once the behaviour when submitting a form is verified, it is not checked again, so the process can be automated.

Before this, ChooK had found a way to get unlimited Metasploit Pro licences through a bug in the Rapid7 web application, and he published a full proof of concept for that on his website. While looking into how to automate the licence grab, he ended up looking at the reCAPTCHA in front of the form instead. He says he paused that automation work without results and will keep the code secret for now, but he wrote this report so that someone else could take the idea further, and with the right code even build a CAPTCHA bypass.

Background: what Protocol Buffers are

To follow the attack you need one idea first: Protocol Buffers, often shortened to protobuf.

Think of a parcel. You can send someone a cardboard box with items loose inside, or you can pack everything into a tight, labelled, standard-sized crate that the receiver knows exactly how to unpack. Protocol Buffers is the tight crate. It is a way of packing structured data into a compact binary form so that two programs, possibly written in different languages, can exchange it reliably.

The report quotes Google's own description:

"Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data, think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages."

In the researcher's words, it is a metalanguage Google uses to parse and process data that must be serialised, keeping it private and confidential between client and server. For this attack the relevant point is simple: the reCAPTCHA conversation between your browser and Google travels in this binary format, and parts of that conversation can be reused.

How reCAPTCHA is set up on a form

To put reCAPTCHA on a form, the site owner first needs a reCAPTCHA Enterprise licence key, and then sets up a series of processes through the REST API or RPC as required. An API (Application Programming Interface) is just a way for one program to talk to another: a menu of requests a service accepts and the answers it gives back. REST and RPC are two common styles of such a menu. The report does not go deeper into the setup and instead points to the reCAPTCHA Enterprise documentation.

The report also points to the public interface definitions in the googleapis/googleapis repository, specifically google/cloud/recaptchaenterprise/v1/recaptchaenterprise.proto, as the reference for how the communication over Protocol Buffer is defined. A .proto file is the blueprint that says which fields a message has and what type each one is, a bit like a form template that says "name goes here, date goes there".

GitHub ScrenShot about ProtocolBuffer in GRecaptcha From the original on medium.com

The screenshot shows the Protocol Buffer material for reCAPTCHA in the Google APIs repository.

To make the flow clearer, the researcher drew a diagram of what happens under the hood of a reCAPTCHA implementation when a form is filled in and sent.

G.Recaptcha User Interaction Flow
G.Recaptcha User Interaction Flow From the original on medium.com

The diagram shows the user interaction flow with G. reCAPTCHA during a form submission.

How to test it

The researcher's investigation led him to an implementation flaw: once the behaviour when submitting a form is verified, it is not checked again. That means the verification step can be abused by automating the process, which breaks the integrity and objective of the CAPTCHA. The report demonstrates the manual way to review the bug and explains why and how it can be automated.

Setup

The testing was done by hand, with Burp Suite Professional as the intercepting proxy. A proxy sits between your browser and the internet and lets you read and edit every request and response that passes through, like a postal worker who opens every letter, reads it, and can put it back in a new envelope. The target was a form on a Rapid7 property, used with permission from Rapid7 as a testing laboratory. The researcher notes that random data can be used to fill the form, and that a temporary mail service (Tempmail) is an option for the email field. No account, role or special privilege is described beyond being able to load and submit the public form.

Finding it

Exploitation, step by step

Step 1: Confirm the form is protected

The first step is to fill the form with random data and observe that the site is indeed protected with reCAPTCHA. This matters because you need to know what you are up against before you start: is there a visible checkbox, an invisible check, or nothing at all? Here the answer is a reCAPTCHA.

Live PoC Flow #1 From the original on medium.com

The screenshot is labelled Live PoC Flow #1.

Step 2: Read the site key from the page source

In the source code of the page, the data-sitekey attribute for the G-reCAPTCHA can be seen. The page source is the raw HTML that your browser receives before it draws the page; you can see it with the browser's "view source" option. A site key is a public identifier that tells Google which site the CAPTCHA belongs to, a bit like a shop's name on a receipt. It is not a secret, but it is useful to know because it ties the widget to the right reCAPTCHA configuration.

Live PoC Flow #2 From the original on medium.com

The screenshot is labelled Live PoC Flow #2.

The G-reCAPTCHA logo is also visible on the website itself.

Live PoC Flow #3 From the original on medium.com

The screenshot is labelled Live PoC Flow #3.

Step 3: Capture the Protocol Buffer request

After submitting the form, a request using the x-protobuffer content type appears in the Burp Suite Professional proxy. A content type is a label on a message that says what format the body is in, the way an envelope might be marked "fragile" or "documents enclosed". Here the label says the body is a Protocol Buffer, which is the binary crate described earlier.

Live PoC Flow #4 From the original on medium.com

The screenshot is labelled Live PoC Flow #4.

Step 4: Replay the request and observe the response

In Burp Repeater, every time this request is sent, a rresp parameter comes back in the response, again in x-protobuffer format. Repeater is a Burp tool that lets you send the same request again and again, changing it if you like, and read each answer. The rresp value is the part of the answer that the form uses as its CAPTCHA result.

Live PoC Flow #5 From the original on medium.com

The screenshot is labelled Live PoC Flow #5.

This is the final sent form:

Live PoC Flow #6 From the original on medium.com

The screenshot is labelled Live PoC Flow #6.

Step 5: Reuse the captured request to generate responses

With the previously captured X-Protobuffer reload request, the researcher generates unlimited G-captchaResponse values and sends massive form requests. In plain terms: he keeps the one captured request, sends it again and again to get an rresp each time, and feeds those values into a large number of form submissions.

Live PoC Flow #7 GIF ProtoBuff Reutilization From the original on medium.com

The GIF is labelled Live PoC Flow #7 GIF ProtoBuff Reutilization.

The result, in the researcher's words: CAPTCHA Defeated.

From the original on medium.com

Why it works

The report describes the flaw as an implementation issue: once the behaviour when submitting a form is verified, it is not checked again. Because the reload request can be replayed to obtain an rresp each time, an attacker who captures it can generate G-captchaResponse values and drive bulk submissions. The report does not go into the server-side code that performs the check; the observable behaviour is that replaying the captured request keeps producing an rresp.

Impact

Under the conditions shown, an attacker can defeat the CAPTCHA on a form protected by reCAPTCHA v2 Invisible and submit the form in bulk, which removes the protection the CAPTCHA is meant to provide against automated abuse. The demonstration was carried out against a Rapid7 form with Rapid7's permission. The report does not quantify the volume of submissions achieved or describe any other effect on the target.

Timeline

  1. 17/10/21: bug found and tested in custom environments.
  2. 18/10/21: reported to Rapid7.
  3. 20/10/21: Rapid7 confirmed the bug.

The researcher states that a tool is coming soon. The report does not describe any fix applied by the vendor.

Variants to test

Glossary

  • reCAPTCHA: Google's service that tries to tell humans from bots on web forms.
  • reCAPTCHA v2 Invisible: a version of reCAPTCHA that runs without a visible checkbox, checking the visitor in the background.
  • CAPTCHA bypass: getting past a CAPTCHA check without actually solving its challenge.
  • Bot: an automated program that performs actions on a website, often at scale.
  • Protocol Buffers (protobuf): Google's compact binary format for packing structured data so two programs can exchange it.
  • Serialisation: turning data in memory into a stream of bytes that can be sent or stored, and read back later.
  • Metalanguage: a language used to describe or define other data structures, as the researcher calls Protocol Buffers.
  • .proto file: a blueprint file that defines the fields and types of a Protocol Buffer message.
  • API (Application Programming Interface): a defined set of requests one program can make to another and the answers it gets back.
  • REST: a common style of web API built around standard HTTP requests.
  • RPC (Remote Procedure Call): a style where a program calls a function on another machine as if it were local.
  • reCAPTCHA Enterprise: Google's paid reCAPTCHA product, which requires a licence key to set up.
  • Licence key: a credential that identifies a paying customer of a service.
  • Site key (data-sitekey): a public identifier in the page HTML that tells Google which site a reCAPTCHA widget belongs to.
  • HTML page source: the raw markup a browser receives before rendering the page.
  • Content type (x-protobuffer): a label on a request or response saying what format the body uses; here it marks a Protocol Buffer body.
  • Proxy: a tool that sits between browser and server and lets you read and edit the traffic.
  • Burp Suite Professional: a commercial intercepting proxy used for web security testing.
  • Burp Repeater: a Burp tool for resending a captured request repeatedly and reading each response.
  • Request: a message a browser (or tool) sends to a server asking it to do something.
  • Response: the message a server sends back.
  • Replay: sending a previously captured request again.
  • rresp: the parameter returned in the Protocol Buffer response when the reload request is replayed.
  • G-captchaResponse: the value the researcher generates from the captured request and uses in bulk form submissions.
  • Implementation flaw: a weakness in how a feature was built or wired up, rather than in the underlying product itself.
  • Integrity: the property that data or a check cannot be altered or reused in ways it was not meant to be.
  • Tempmail: a temporary email service used to receive throwaway messages.
  • Proof of concept (PoC): a demonstration that a vulnerability can actually be exploited.
  • Metasploit Pro: a Rapid7 commercial penetration-testing product that requires a licence.
  • Vendor: the company that makes or runs the affected product or site.

More by ChooK

View all

1 more disclosed report, best first.

More from Rapid7

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.