Skip to content

PKCS#11: DB PIN counter reset attack

Low
jbech-linaro published GHSA-2f5m-q4w3-865p Feb 2, 2024

Package

OP-TEE

Affected versions

<=4.0.0

Patched versions

4.1.0 and later

Description

There is a brute-forcing possibility if the REE side purposely causes DB update failure after invalid PIN check.

The PKCS#11 TA updates its database on PIN check failure, but not on success, from non-trusted side (REE), we can discard the related media write access (e.g. RPMB write) to prevent PKCS#11 database update.

Trigger the problem

Simplified flow

1. db.pin-counter = 0
2. Pin check failure
3. db.pin-counter = 1
4. save(db)
5. return error

If REE side (REE-FS, RPMB etc) causes step 4 to fail (TA panic), an attacker can retry PIN check with a zero pin-counter on next boot.

1. db.pin-counter = 0
2. Pin check failure
3. db.pin-counter = 1
4. save(db) => discard, panic, reset...

This change ensures that the pin counter is pre-incremented before PIN checking and only cleared on success.

Patches

optee_os.git

Workarounds

Make sure to include the patch above in your builds.

References

N/A

OP-TEE ID

OP-TEE-2023-0002

Reported by

For more information

For more information regarding the security incident process in OP-TEE, please read the information that can be found when going to the "Security" page at https://www.trustedfirmware.org.

Timeline

2023-10-27: Report received.
2023-10-30: Proof of concept code provided.
2023-11-08: Notified Trusted Stakeholders, mitigation patch provided.
2023-11-10: Pull request 6445 merged.
2024-02-02: Issue published and stakeholders notified.

Severity

Low

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Local
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
None
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:C/C:L/I:N/A:N

CVE ID

No known CVE

Weaknesses

No CWEs

Credits