Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix Any recursion depth bypass in Python json_format.ParseDict#25239

Closed
aviralgarg05 wants to merge 1 commit intoprotocolbuffers:mainfrom
aviralgarg05:fix-any-recursion-depth-bypass
Closed

Fix Any recursion depth bypass in Python json_format.ParseDict#25239
aviralgarg05 wants to merge 1 commit intoprotocolbuffers:mainfrom
aviralgarg05:fix-any-recursion-depth-bypass

Conversation

Copy link
Contributor

aviralgarg05 commented Jan 9, 2026

This fixes a security vulnerability where nested google.protobuf.Any messages could bypass the max_recursion_depth limit, potentially leading to denial of service via stack overflow.

The root cause was that _ConvertAnyMessage() was calling itself recursively via methodcaller() for nested well-known types, bypassing the recursion depth tracking in ConvertMessage().

The fix routes well-known type parsing through ConvertMessage() to ensure proper recursion depth accounting for all message types including nested Any.

Fixes #25070

KyleMylonakisProtopia, cavanierc, zendritic, WebedMJ, kyo-ago, msenjem, c-schoenherr, graipher, guidoiaquinti, matdibu, and 10 more reacted with eyes emoji
aviralgarg05 requested a review from a team as a code owner January 9, 2026 15:34
aviralgarg05 requested review from anandolee and removed request for a team January 9, 2026 15:34
anandolee self-assigned this Jan 12, 2026
anandolee added python [A] safe for tests Mark a commit as safe to run presubmits over labels Jan 12, 2026
github-actions bot removed the [A] safe for tests Mark a commit as safe to run presubmits over label Jan 12, 2026
anandolee approved these changes Jan 23, 2026
Copy link

ankitsinha-cmyk left a comment *
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider:

  1. Add a comment clarifying how you count depth and whether max_recursion_depth is inclusive/exclusive.

  2. Adding a test that explicitly asserts that depth==max_recursion_depth-1 succeeds and depth==max_recursion_depth fails, so the boundary behavior is documented.

aviralgarg05 and px-ssilveri reacted with thumbs up emoji
aviralgarg05 force-pushed the fix-any-recursion-depth-bypass branch from f5f10f2 to 3cbbcbe Compare January 24, 2026 08:24
coderabbitai bot mentioned this pull request Jan 24, 2026
bittner mentioned this pull request Jan 25, 2026
Copy link

benglewis commented Jan 25, 2026

I understand this this is failing CI/CD and all... but we are stuck with our packages failing on vulnerabilities with this fix. What is the ETA for getting this merged?

lebaudantoine, moleary-cr, vprivat-ads, rkolze, FirstAVBoy, graipher, leandrodamascena, fbexiga, sam-pd, astupp, and 38 more reacted with thumbs up emoji arvindnama and erklem reacted with eyes emoji

aviralgarg05 requested a review from ankitsinha-cmyk January 25, 2026 11:12
Copy link

ankitsinha-cmyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aviralgarg05 thanks for incorporating the changes. Looks fine to me now.

aviralgarg05 and rkolze reacted with thumbs up emoji
lebaudantoine added a commit to suitenumerique/meet that referenced this pull request Jan 25, 2026
A new vulnerability (CVE-2026-0994) was reported and is not yet fixed. It affects
protobuf libraries used by the livekit-api Python package.

A fix is in progress upstream, but the related PR has not yet been merged or
released. Since a release is required tonight, the Trivy scan step is
temporarily disabled to allow the build to proceed. This should be re-enabled
once a patched version is available.

protocolbuffers/protobuf#25239
lebaudantoine added a commit to suitenumerique/meet that referenced this pull request Jan 25, 2026
A new vulnerability (CVE-2026-0994) was reported and is not yet fixed.
It affects protobuf libraries used by the livekit-api Python package.

A fix is in progress upstream, but the related PR has not yet been merged or
released. Since a release is required tonight, the Trivy scan step is
temporarily disabled to allow the build to proceed. This should be re-enabled
once a patched version is available.

protocolbuffers/protobuf#25239
lebaudantoine added a commit to suitenumerique/meet that referenced this pull request Jan 25, 2026
A new vulnerability (CVE-2026-0994) was reported and is not yet fixed.
It affects protobuf libraries used by the livekit-api Python package.

A fix is in progress upstream, but the related PR has not yet been merged or
released. Since a release is required tonight, the Trivy scan step is
temporarily disabled to allow the build to proceed. This should be re-enabled
once a patched version is available.

protocolbuffers/protobuf#25239
lebaudantoine added a commit to suitenumerique/meet that referenced this pull request Jan 25, 2026
A new vulnerability (CVE-2026-0994) was reported and is not yet fixed.
It affects protobuf libraries used by the livekit-api Python package.

A fix is in progress upstream, but the related PR has not yet been merged or
released. Since a release is required tonight, the Trivy scan step is
temporarily disabled to allow the build to proceed. This should be re-enabled
once a patched version is available.

protocolbuffers/protobuf#25239
coderabbitai bot mentioned this pull request Jan 26, 2026
aponcedeleonch added a commit to StacklokLabs/mcp-optimizer that referenced this pull request Jan 26, 2026
This will enable running the CI and its checks. There is a fix
upstream waiting to be merged and released: protocolbuffers/protobuf#25239
aponcedeleonch added a commit to StacklokLabs/mcp-optimizer that referenced this pull request Jan 26, 2026
This will enable running the CI and its checks. There is a fix
upstream waiting to be merged and released: protocolbuffers/protobuf#25239
aponcedeleonch added a commit to StacklokLabs/mcp-optimizer that referenced this pull request Jan 26, 2026
This will enable running the CI and its checks. There is a fix
upstream waiting to be merged and released: protocolbuffers/protobuf#25239
Copy link

inderps commented Jan 29, 2026

I find it strange that a fix has been available for days while this vunerability is already breaking pipelines across the ecosystem.

Meanwhile this seems stuck in process overhead :(

KaramanJoe, crmpicco, andreitere, test-dan-run, j-kyri, thanusiak, dinosaursrarr, adrianhaj, vprivat-ads, vvagaytsev, and 7 more reacted with thumbs up emoji

Copy link

vprivat-ads commented Jan 29, 2026

@zhangskz can you please release a new version with this security fix?

vvagaytsev, andreitere, and msenjem reacted with thumbs up emoji

Copy link

Kludex commented Jan 29, 2026

I can't express how absurd this whole situation is.

Please, next time have a release ready before approving a CVE. I don't know who made this obvious mistake, but you've annoyed a lot of people that care about security. Just leave the report there forever instead of making the thing public.

vprivat-ads, andreitere, j-kyri, dinosaursrarr, cavanierc, gnuletik, danielwiegand, loic35, kt-mkreczmer, drnextgis, and brianquirion reacted with thumbs up emoji lucas42 reacted with thumbs down emoji

Copy link

DhavalGojiya commented Jan 29, 2026

Any update on this?

Copy link

paulhodson commented Jan 29, 2026

pip-audit has now started to fail "out in the world" for things that use protobuf, which will probably cause many pipelines out there to fail.

Just to share while waiting on the new protobuf package release, you can use pip-audit with --ignore-vuln CVE-2026-0994 to remediate pipelines in the near term

crmpicco reacted with heart emoji

Copy link
Contributor

esrauchg commented Jan 29, 2026 *
edited
Loading

Protobuf team member jumping in here.

Please, next time have a release ready before approving a CVE. I don't know who made this obvious mistake, but you've annoyed a lot of people that care about security. Just leave the report there forever instead of making the thing public.

Yes, this was definitely mistake and we'll be tightening up our process to avoid this from happening in the future.

Just for 'how the sausage is made' normally our internal CVE process is so slow that we can open our internal process request to create a CVE and it just inherently takes long enough that we can start that process as soon as we decide a CVE is warranted and it takes longer for that process than it does for us to patch the issue and release the patches.

What went 'wrong' in this case is the internal process surprisingly managed to move fast instead (which should be a good thing), but because it normally is slow we didn't have the proper process for it that to be gated on the patches being released (which is definitely a bad thing).

Sorry for our process failure negatively affecting folks here. Given the CVE is already published now, we'll try to move fast for these patches.

vprivat-ads, matdibu, fcappellari-kt, drnextgis, erklem, bas-slats, AdamPenazDICE, DhavalGojiya, noah-dbc, kt-mkreczmer, and 14 more reacted with thumbs up emoji edgarrmondragon, j-kyri, JTangCoveo, and valabji reacted with heart emoji andreitere, DhavalGojiya, CamLamb, cowpowder, noah-dbc, arthurgousset, ArturKasymov, kluever, fakegermano, and valabji reacted with rocket emoji

This fixes a security vulnerability where nested google.protobuf.Any messages
could bypass the max_recursion_depth limit, potentially leading to denial of
service via stack overflow.

The root cause was that _ConvertAnyMessage() was calling itself recursively
via methodcaller() for nested well-known types, bypassing the recursion depth
tracking in ConvertMessage().

The fix routes well-known type parsing through ConvertMessage() to ensure
proper recursion depth accounting for all message types including nested Any.

Fixes protocolbuffers#25070
Copy link

crmpicco commented Jan 30, 2026

Thanks @paulhodson , that is a useful tip for future

Copy link

obs-gh-nikhildua commented Feb 4, 2026 *
edited
Loading

@aviralgarg05 @ankitsinha-cmyk @anandolee Is there any plans to bring this to version 4.25.x? We run a cloud function which depends on this version and updating will cause backwards incompatibility with other library versions as well for our customers. Thanks!

Datise and AlJohri reacted with thumbs up emoji

Copy link

sfc-gh-ndua commented Feb 23, 2026

@aviralgarg05 @ankitsinha-cmyk @anandolee Is there any plans to bring this to version 4.25.x? We run a cloud function which depends on this version and updating will cause backwards incompatibility with other library versions as well for our customers. Thanks!

Any update on above? Thanks!

Copy link
Contributor

esrauchg commented Feb 23, 2026

We don't plan to backport to 4.25 as Py 4.x has has been end of lifed for a year (after a year of high prio fixes only). See the chart here:
https://protobuf.dev/support/version-support/#:~:text=TBD-,Release%20support%20chart,-Protobuf%20Python

The 25.x line is still specially maintenance support just for Java (so the same issue happening in Java would get a backport by contrast).

Note that we're even in the final quarter of official high prio backports only for Py 5.x, so 4.x is getting quite behind the version treadmill here.

Note that the breaking changes across this version boundaries are intentionally minor/obscure including that old gencode is still compatible, as described here:
https://protobuf.dev/support/cross-version-runtime-guarantee/#:~:text=minor%2C%20or%20micro).-,Python%2Dspecific%20Guarantees,-Since%20the%203.20.0

So we expect it should be rare that anyone should not be able to upgrade past these major version numbers without changing their application code at all.

Copy link

sfc-gh-ndua commented Feb 24, 2026 *
edited
Loading

We don't plan to backport to 4.25 as Py 4.x has has been end of lifed for a year (after a year of high prio fixes only). See the chart here: https://protobuf.dev/support/version-support/#:~:text=TBD-,Release%20support%20chart,-Protobuf%20Python

The 25.x line is still specially maintenance support just for Java (so the same issue happening in Java would get a backport by contrast).

Note that we're even in the final quarter of official high prio backports only for Py 5.x, so 4.x is getting quite behind the version treadmill here.

Note that the breaking changes across this version boundaries are intentionally minor/obscure including that old gencode is still compatible, as described here: https://protobuf.dev/support/cross-version-runtime-guarantee/#:~:text=minor%2C%20or%20micro).-,Python%2Dspecific%20Guarantees,-Since%20the%203.20.0

So we expect it should be rare that anyone should not be able to upgrade past these major version numbers without changing their application code at all.

Thanks! We have other dependencies that will break such as google-cloud-sdk libs (https://github.com/observeinc/google-cloud-functions/blob/main/requirements.txt#L48)

=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-access-context-manager 0.1.16 requires protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-os-config 1.15.3 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-tasks 2.14.2 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-appengine-logging 1.4.3 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. grpc-google-iam-v1 0.12.6 requires protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-pubsub 2.18.4 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-asset 3.25.0 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. googleapis-common-protos 1.61.0 requires protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0.dev0,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-compute 1.14.1 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. proto-plus 1.22.3 requires protobuf<5.0.0dev">venv) google-cloud-functions git:(main) python -m pip install -U "protobuf==6.33.5" Collecting protobuf==6.33.5 Using cached protobuf-6.33.5-cp39-abi3-macosx_10_9_universal2.whl.metadat a (593 bytes) Downloading protobuf-6.33.5-cp39-abi3-macosx_10_9_universal2.whl (427 kB) Installing collected packages: protobuf Attempting uninstall: protobuf Found existing installation: protobuf 4.25.8 Uninstalling protobuf-4.25.8: Successfully uninstalled protobuf-4.25.8 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. google-cloud-org-policy 1.8.3 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-access-context-manager 0.1.16 requires protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-os-config 1.15.3 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-tasks 2.14.2 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-appengine-logging 1.4.3 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. grpc-google-iam-v1 0.12.6 requires protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-pubsub 2.18.4 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-asset 3.25.0 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. googleapis-common-protos 1.61.0 requires protobuf!=3.20.0,!=3.20.1,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0.dev0,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. google-cloud-compute 1.14.1 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 6.33.5 which is incompatible. proto-plus 1.22.3 requires protobuf<5.0.0dev

Copy link

psibre commented Feb 25, 2026

@sfc-gh-ndua I don't want to tell you how to manage your dependencies, but all of the Google Cloud packages you have are apparently pinned to versions from around 2023. But they're all actively maintained and have had many releases since then, which are presumably compatible with protobuf v5+. So you could just upgrade them...?

Copy link
Contributor

esrauchg commented Feb 25, 2026 *
edited
Loading

Speaking authoritatively for Protobuf project: it does looking to me that cloud-sdk libs are stuck behind here (at least for their default set version, unclear about true-compatibility) and they is one of our biggest Google library usages. We'll follow up on that internally to see why its still stuck.

Broadly we also know being 3 years behind on some deps is also relatively normal for lots of projects; we are just trying to thread the needle on being able to make changes that keep Protobuf healthy while still avoiding breaking people; there's unfortunately a direct tension where total stability (which we did for a while) makes things stagnant on all axes which ends up slowly building up over time to harm.

We do try very hard to keep the breaking changes obscure to avoid people's difficulties upgrading. We had made some missteps with our last Java breaking change, which is partially why it has an extended support window, so we also know that even smaller seeming breaks can cause big problems for some customers.

We are likely to do a 25 release for an unrelated Java issue; depending on the state of Cloud SDK and difficulty in releasing the backport we may consider backporting this thing to Py 4.x as well even though its officially end of life (but no promises here).

Thanks!

coderabbitai bot mentioned this pull request Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

anandolee Awaiting requested review from anandolee

1 more reviewer

ankitsinha-cmyk ankitsinha-cmyk left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

anandolee

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Any JSON recursion depth bypass in Python json_format.ParseDict