PyCQA / PyCQA/bandit

Mark use of `PKCS1v15` for encryption and decryption a vulnerability

Open
#1,071 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
8.3k
Forks
835
Avg merge
5d 3h
Merged PRs (30d)
1

Description

Is your feature request related to a problem? Please describe.
While pyca/cryptography is generally a high quality wrapper around OpenSSL, because of peculiarities of Python it is impossible to handle PKCS#1 v1.5 decryption failures in side channel free manner. As such, all usages of it will leak information useful in mounting the Bleichenbacher/Marvin attack: https://github.com/pyca/cryptography/issues/9785

Describe the solution you'd like
Any use of the cryptography.hazmat.primitives.asymmetric.padding.PKCS1v15 for decryption (or encryption) should be marked as vulnerabilities.

Describe alternatives you've considered
it's impossible to handle exceptions in Python in side-channel free manner
the PKCS#1 v1.5 is known to be insecure for over 25 years at this point, it's high time to stop use of it

the alternative is to use RSA-OAEP encryption

Additional context
https://people.redhat.com/~hkario/marvin/

Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating Bandit's existing checks for Python security-sensitive API calls and determine how calls to cryptography.hazmat.primitives.asymmetric.padding.PKCS1v15 are represented. Add coverage for encryption and decryption uses, then run the relevant security-check tests; done means those uses are reported as vulnerabilities while RSA-OAEP is not.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.