Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potential DOS risk with pydantic - fix pending #1477

Closed
samuelcolvin opened this issue May 5, 2020 · 9 comments · Fixed by #4480
Closed

potential DOS risk with pydantic - fix pending #1477

samuelcolvin opened this issue May 5, 2020 · 9 comments · Fixed by #4480
Labels
bug V1 Bug related to Pydantic V1.X Security security issues with pydantic

Comments

@samuelcolvin
Copy link
Member

I have been made aware of a potential DOS attack risk in pydantic.

The fix I believe is relatively trivial, I will release:

  • v1.5.2 based of the current v1.5.1 tag
  • v1.4.1 based of the current v1.4 tag

These releases will be made just after 1pm UTC on 2020/5/11, that's next Monday.

If you require a fix to any other version, please let me know on this issue.

@samuelcolvin samuelcolvin added the Security security issues with pydantic label May 5, 2020
@samuelcolvin samuelcolvin pinned this issue May 5, 2020
@samuelcolvin samuelcolvin added the bug V1 Bug related to Pydantic V1.X label May 5, 2020
@samuelcolvin
Copy link
Member Author

To wait for potential upstream fixes to this issue, these releases have been delayed.

I'll comment here as soon as I know when a fix can be released for pydantic.

@samuelcolvin samuelcolvin unpinned this issue May 6, 2020
@PrettyWood
Copy link
Member

Is this issue still necessary?

@samuelcolvin
Copy link
Member Author

samuelcolvin commented Jan 3, 2021

The python security team have not yet fixed the the upstream error (I don't really understand why) but have ask packages not to mitigate the problem in libraries to avoid making it public.

The whole situation is frustrating.

@mruser
Copy link

mruser commented Jan 5, 2022

Hi Samuel, is the underlying vulnerability still present in the upstream such that the DOS risk survives in the current version of the library? If not, what version was the issue resolved in? Thank you.

Also, I believe we are well into responsible disclosure territory with respect to the upstream, given the time period that has elapsed.

@samuelcolvin
Copy link
Member Author

Quick update on this since a few people have asked about it.

This an issue in cpython, it's not specific to pydantic. All versions of python are effected.

The python security list were informed about it back in 2020 but after a flurry of initial emails, progress on a fix stopped as far as I'm aware.

After @mruser's comment 2 weeks ago, I followed up with a few individuals involved and tried to press for a proper fix.

The last update was 2 days ago, that the issue was being discussed between some core devs. and the SC.


In short, while I'm disappointed this hasn't fixed sooner, I'm hopeful it will be fixed soon.

I was asked not to fix it in pydantic to avoid making the vulnerability public, I'll stick to that for another few months in the hope of an upstream fix.

@malipek
Copy link

malipek commented Jan 27, 2022

Is the vulnerability somehow connected to the well known issues with NaN implementation? If so, the issue should be closed, in my opinion.

@samuelcolvin
Copy link
Member Author

No

@dmkr
Copy link

dmkr commented Mar 10, 2022

Is this issue effecting all versions of Pydantic, on version 1.4 and beyond, or only on 1.4 and 1.5.1?

@samuelcolvin
Copy link
Member Author

This has now been made public and it seems a fix will be out soon.

python/cpython#95778

If you're parsing, JSON the simplest solution is to use ujson which doesn't suffer from this problem.

I'll see if I can get a fix it which limits input to ints soon.

@samuelcolvin samuelcolvin mentioned this issue Sep 3, 2022
6 tasks
samuelcolvin added a commit that referenced this issue Sep 5, 2022
* prevent long strings as int inputs, fix #1477

* fix tests 🤦

* fix length in change file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X Security security issues with pydantic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants