Mitigate timing oracle using dummy hash cache - #1116
Conversation
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
6be2e53 to
49470f2
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
49470f2 to
f1ec2b3
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
f1ec2b3 to
4c429fa
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
No new issues found in the changed files. ✅
4c429fa to
101b87a
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
No new issues found in the changed files. ✅
101b87a to
be56e50
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
be56e50 to
568fea0
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
568fea0 to
b1ea836
Compare
b1ea836 to
dc37d33
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
dc37d33 to
5732e90
Compare
5732e90 to
2dd784c
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
2dd784c to
da0f70b
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
No new issues found in the changed files. ✅
da0f70b to
1b6b43a
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
1b6b43a to
eca6900
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1116
Scan targets checked: wolfssh-bugs, wolfssh-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Findings are non-blocking.
| hashIdx += authData->username[i]; | ||
| } | ||
| } | ||
| fakeHash = cachedFakeHashes[hashIdx % numCachedFakeHashes]; |
There was a problem hiding this comment.
🟠 [Medium] Attacker-controlled username selects fake-hash cost, reintroducing timing skew on mixed-algorithm systems · Constant-time violations
hashIdx is a sum of the fully attacker-controlled authData->username bytes, so a remote client chooses which cached crypt cost is used for the dummy check. On systems with heterogeneous hash costs (e.g. bcrypt vs SHA-512-rounds accounts), this decouples the dummy check's timing from a targeted real user's actual cost, letting an attacker isolate the intended per-user timing signal by picking usernames that hash to a specific cache slot.
Fix: Select the fake-hash cache slot independent of attacker input (e.g. round-robin or fixed slot) instead of hashing the client-supplied username.
There was a problem hiding this comment.
Round-robin would still be an oracle and fixed slot wouldn't help for mixed-algo systems. Will use the worst case crypt fixed slot and use a delay to equalize real, faster crypts to the worst case.
Does a fake crypt() operation when an authentication attempt is rejected early and caches hash type at SSHD startup. CI testing is added for this change.