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

[MASWE-0023] Weak Padding #2922

Merged
merged 21 commits into from
Jan 16, 2025
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a4d6067
Added MASWE-0019.md
jmariasantosdekra Aug 5, 2024
6d2ee8e
Removed blank spaces from MASWE-0019.md
jmariasantosdekra Aug 5, 2024
d09e475
Added newline at the end of MASWE-0019.md
jmariasantosdekra Aug 5, 2024
611a6df
Update weaknesses/MASVS-CRYPTO/MASWE-0019.md
jmariasantosdekra Sep 4, 2024
45ad705
Update weaknesses/MASVS-CRYPTO/MASWE-0019.md
jmariasantosdekra Sep 4, 2024
531a37a
Update weaknesses/MASVS-CRYPTO/MASWE-0019.md
jmariasantosdekra Sep 4, 2024
49dadc5
Update weaknesses/MASVS-CRYPTO/MASWE-0019.md
jmariasantosdekra Sep 4, 2024
f7fe868
Update weaknesses/MASVS-CRYPTO/MASWE-0019.md
jmariasantosdekra Sep 4, 2024
ed95b33
Update weaknesses/MASVS-CRYPTO/MASWE-0019.md
jmariasantosdekra Sep 4, 2024
ff7dff2
Update weaknesses/MASVS-CRYPTO/MASWE-0019.md
jmariasantosdekra Sep 4, 2024
9b7a164
Update MASWE-0019.md
jmariasantosdekra Sep 4, 2024
722d802
Update weaknesses/MASVS-CRYPTO/MASWE-0019.md
cpholguera Sep 4, 2024
903993b
Merge branch 'OWASP:master' into master
jmariasantosdekra Oct 15, 2024
b660943
Merge branch 'OWASP:master' into master
jmariasantosdekra Oct 28, 2024
61a1fb5
Added MASWE-0023.md content
jmariasantosdekra Oct 28, 2024
8adaaea
Removed newlines and blank spaces
jmariasantosdekra Oct 28, 2024
74d6df0
Added final blankspace
jmariasantosdekra Oct 28, 2024
0f3b756
Update weaknesses/MASVS-CRYPTO/MASWE-0023.md
jmariasantosdekra Jan 10, 2025
336a22f
Update MASWE-0023.md
jmariasantosdekra Jan 10, 2025
06ea678
Update MASWE-0023.md
jmariasantosdekra Jan 14, 2025
3251f66
remove some unneded points
cpholguera Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions weaknesses/MASVS-CRYPTO/MASWE-0023.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,32 @@ profiles: [L1, L2]
mappings:
masvs-v1: [MSTG-CRYPTO-4]
masvs-v2: [MASVS-CRYPTO-1]
mastg-v1: [MASTG-TEST-0014]

refs:
- https://developer.android.com/privacy-and-security/cryptography#deprecated-functionality
- https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar2.pdf
- https://nvlpubs.nist.gov/nistpubs/legacy/sp/nistspecialpublication800-38a.pdf
- https://www.bsi.bund.de/SharedDocs/Downloads/EN/BSI/Publications/TechGuidelines/TG02102/BSI-TR-02102-1.pdf?__blob=publicationFile
draft:
description: The use of weak padding such as NoPadding, ZeroPadding, etc. in a security
sensitive context should be avoided to ensure the integrity and authenticity of
the data.
topics:
- NoPadding
- PKCS1-v1_5
status: draft

- https://www.usenix.org/legacy/event/woot10/tech/full_papers/Rizzo.pdf
status: new
---
jmariasantosdekra marked this conversation as resolved.
Show resolved Hide resolved

## Overview

Outdated or weak padding schemes, such as PKCS1v1.5 or other padding schemes that fail to comply with secure standards, as outlined in [NIST SP 800-131A Rev.2, Section 6 Key Agreement and Key Transport Using RSA](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-131Ar2.pdf) are not recommended for use. These padding schemes include vulnerabilities that may allow attackers to undermine security mechanisms, such as [padding oracle attacks](https://www.usenix.org/legacy/event/woot10/tech/full_papers/Rizzo.pdf).

## Impact

- **Loss of data integrity**: Padding attacks can help attackers manipulate ciphertext, leading to unauthorized data modifications. By modifying the ciphertext and observing how the system responds, attackers can alter encrypted data in a way that the system decrypts it without detecting any issues. This allows the system to accept the altered data as valid, compromising its integrity.
- **Compromised confidentiality**: Weak padding can enable attackers to recover plaintext from encrypted data. Vulnerable implementations may leak information about the correctness of padding through error messages, which attackers can use to gradually decrypt sensitive information such as passwords or session tokens, compromising the confidentiality of the data.

## Modes of Introduction

- **Insecure padding scheme**: Using padding schemes that are vulnerable to attacks, such as PKCS1V1.5 or PKCS#7 when used with CBC mode of operation.
- **Custom padding solutions**: Implementing custom or non-standard padding schemes that have not been sufficiently tested or that lack certification.
- **Improper padding validation**: Failure to correctly validate and handle padding errors, potentially leaking information to attackers via error messages or timing discrepancies.

## Mitigations

- **Implement proper and secure padding validation**: Use established and secure padding schemes, ensuring that padding is properly validated when necessary for the encryption mode. When possible, use authenticated encryption modes like GCM, which eliminate the need for padding and include built-in integrity verification.
Loading