From 9149c8c67cdf1ad049a6155b0713388a0f6b16ee Mon Sep 17 00:00:00 2001 From: hyugogirubato <65763543+hyugogirubato@users.noreply.github.com> Date: Tue, 28 Apr 2026 21:09:33 +0200 Subject: [PATCH] fix aggressive memory read --- keydive/keydive.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/keydive/keydive.js b/keydive/keydive.js index f7558d8..22e75b7 100644 --- a/keydive/keydive.js +++ b/keydive/keydive.js @@ -1,5 +1,5 @@ /** - * Date: 2026-04-26 + * Date: 2026-04-28 * Description: DRM key extraction for research and educational purposes. * Source: https://github.com/hyugogirubato/KeyDive */ @@ -826,12 +826,12 @@ function Level3_RewrapDeviceRSAKey30(address, name) { */ Interceptor.attach(address, { onEnter: function (args) { - const bufferPtr = args[5]; - const sizePtr = args[6]; + try { + const bufferPtr = args[5]; + const sizePtr = args[6]; - if (!(sizePtr.isNull() || bufferPtr.isNull())) { - // Check if this is a pointer to a buffer - if (bufferPtr < 0x10000) return; + if (sizePtr.isNull() || bufferPtr.isNull()) return; + if (bufferPtr.compare(ptr(0x10000)) < 0) return; // Check if the size matches a potential 2048 or 4096-bit RSA private key (range 1190-2350) const size = sizePtr.toInt32(); @@ -842,7 +842,7 @@ function Level3_RewrapDeviceRSAKey30(address, name) { print(Level.DEBUG, `[*] Level3_RewrapDeviceRSAKey30: ${name}`); send({'private_key': name}, bufferData); } - } + } catch (e) { /* not a real RewrapDeviceRSAKey30 call */ } } }); }