exploit: AES key recovery via ObfuscatedHexDigest arena scan#44
exploit: AES key recovery via ObfuscatedHexDigest arena scan#44Emre-Dinc wants to merge 11 commits intogpu-mode:masterfrom
Conversation
|
mseal cannot help here, because we need to read this later, and mseal cannot be undone. For the actual benchmark calls, we need to start looking more carefully at the CPU timing, so that we can detect expensive operations like unhashing. |
|
lock() should fix this but cpu timing is better long term solution. |
|
what would lock() change here? |
|
I don't know if you like coupling here but my solution was: edit: also for this to work unlock must restore PROT_READ|PROT_WRITE, we do PROT_READ atm. |
|
no, I mean isn't it trivial to adapt the exploit to call mprotect(READ) before the access. Making lock pretty-much pointless? |
|
oh, I was focused on how to protect from this vector that i didn't think about what would be the next vector. yeah you are right. |
|
I've added better obfuscation/hashing for the key pointer (in particular, the size 32 is now also hashed, xor'ed with the offset so you can't just precompute the hash). @Emre-Dinc |
…f main benchmark thread)
|
|
hmm, when testing this, I'm getting "Cheat detected". On linux kernel 6.14. |
|
my bad, I had some local changes and forgot to |
|
Interesting, I tried 4-5 different runs and it was consistent but it turned out to be not. Making a small change to retry until exhausts everything. Also these tests were done on |
|
there are some github merge problems, so I manually merged and pushed. |
The AES-256-GCM result encryption uses
mSignature.data()as the 32-byte key.The key is recoverable because
lock()is never called on the signature pagebefore user code runs — it stays
PROT_READ|PROT_WRITEthroughout.From
kernel()call 2 (call 1 is the compile run, arena is PROT_NONE then):rw-pregions for(w0, 32, offset)matchingObfuscatedHexDigestlayoutslow_unhash(w0)to recover the signature page pointerpage_ptr + offset→ 32-byte AES keyos._exit(0)The signature page is anonymous — mseal never seals it. Landlock allows
/proc/self/mapsreads (read-only filesystem access). Neither defense helps here.tested with
mseal=False, landlock=Trueon rtx5090.