Commit 39f14b8
transport.c: use constant time function for MAC memcmp() (libssh2#1824)
Notes:
libssh2 uses a non-constant-time memcmp() call at transport.c:229 to
verify SSH MAC tags. An on-path attacker can measure per-byte rejection
latency to iteratively recover the correct MAC value without knowledge
of
the secret key, enabling MAC forgery. Empirical testing on macOS with
libssh2 1.11.1_1 yields a t-statistic of 106.78 (threshold >2),
confirming
the oracle is real and practical (estimated 445,659 probes for full
32-byte HMAC-SHA2-256 forgery under lab conditions).
Credit:
[Pramod Kumar](https://github.com/infosecninja)
---------
Co-authored-by: Will Cosgrove <will@everydaysoftware.net>1 parent e7e0383 commit 39f14b8
3 files changed
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
144 | 146 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
230 | 232 | | |
231 | 233 | | |
232 | 234 | | |
| |||
0 commit comments