Commit graph

3346 commits

Author SHA1 Message Date
Sina Karvandi
fa816b4062
v0.23
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
Merge pull request #670 from HyperDbg/dev
2026-08-03 00:04:11 +02:00
sina
ffbfc0416a Revert NewTemp modifications and adjust error messages
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
2026-08-02 11:01:19 +02:00
Sina Karvandi
973182ddfe
Merge pull request #665 from enzo-berry/claude/code-audit-improvements-prdq23
Fix memory-safety and robustness issues in script engine and PCI ID p…
2026-08-02 10:51:04 +02:00
Sina Karvandi
625e75719e
Merge branch 'dev' into claude/code-audit-improvements-prdq23 2026-08-02 10:50:02 +02:00
sina
a24c8c0a91 cleanup for resync serial codes and update CHANGELOG.md
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-08-01 20:49:02 +02:00
Sina Karvandi
12cd4250b5
Merge pull request #664 from HyperDbg/linux
Linux
2026-08-01 20:18:42 +02:00
Max Raulea
622ea9df97 Porting Documentation update
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
2026-08-01 17:09:55 +02:00
Max Raulea
17fb85f366 added header for PLatformCPU 2026-08-01 17:08:20 +02:00
Max Raulea
652721be62 Added Printk in rhw platformDBG file
For debug printing added printk for linux kernel logging.
2026-08-01 17:06:58 +02:00
Max Raulea
953af9388a PlatformCPU Linux Implementation
Filled in the stubs for the windows functions:
KeQueryActiveProcessorCount(0) and KeGetCurrentProcessorNumberEx(NULL).
KeQueryActiveProcessorCount(0) maps one to one to num_online_cpus()
KeGetCurrentProcessorNumberEx(NULL) maps to raw_smp_processor_id(),
however this can also be smp_processor_id(), we have to decide based on
preemption, the latter checks for preemption and throws a warning if it
is executed in preemptible code. (I dont know the kernel code well
enough so this may need some discussion)
2026-08-01 16:54:08 +02:00
Max Raulea
be2c96d192 Environment header file guards
For the kernel module build some libc header files are not present so we
guard them out for the kernel build
2026-08-01 16:52:29 +02:00
Max Raulea
e8650e43ac Linux kernel module build file 2026-08-01 16:51:58 +02:00
Claude
1abdde7702
Fix memory-safety and robustness issues in script engine and PCI ID parser
Code audit of the script engine's scanner/token handling and of the PCI ID
database parser. Each of the issues below was reproduced against the current
code before the fix and re-checked afterwards.

script-engine/scanner.c

  * An unterminated string literal ("abc or L"abc) hung the scanner in an
    endless loop: sgetc() returns EOF without consuming input, and neither
    string loop tested for it, so the token grew until allocation failed.
    Both loops now stop at EOF and report the token as UNKNOWN.

script-engine/common.c

  * AppendByte()/AppendWchar() doubled Token->MaxLen before checking whether
    the larger buffer was actually allocated. After a failed allocation MaxLen
    described memory that did not exist and the next append wrote past the end
    of the old buffer. MaxLen is now committed only on success.

  * CopyToken() allocated strlen(Value) + 1 bytes but carried over the source
    token's Len and MaxLen, so the copy's advertised capacity did not match its
    allocation, and WSTRING payloads were truncated at their first embedded
    null byte. The copy is now sized from Len/MaxLen and copied by length, with
    a fallback to the string length for the grammar tokens in parse-table.c,
    which only initialize Type and Value.

  * NewToken() set MaxLen to the value length, which is zero for an empty
    value. The 'Len >= MaxLen - 1' test in the append routines is unsigned, so
    a zero MaxLen wrapped and disabled buffer growth entirely.

  * IsUnderscore() tested 'c >= '_'', which also accepted the backtick, the
    lowercase letters, '{', '|', '}', '~' and DEL. Register scanning uses it,
    so '@rax|1' was lexed as one malformed register name instead of a register,
    an operator and a number. The pseudo-register path already compared against
    '_' directly.

  * NewTokenList() did not check the allocation of its Head buffer.

  * NewTemp() kept the last handed-out id in a static, so an exhausted temp
    list produced a token aliasing a temporary still in use, and it derived
    MaxTempNumber from an out-of-range index. It also dereferenced the new
    token without a null check.

  * FreeTemp() indexed the MAX_TEMP_COUNT-entry map with an unchecked value
    parsed out of the token text.

  * RotateLeftStringOnce() wrote to str[-1] when handed an empty string.

libhyperdbg/debugger/misc/pci-id.cpp

  * The database file was read into a malloc(Length) buffer that was never
    null-terminated, while ReadLine() walks it with strchr(). Looking up an
    absent vendor scans to the end and reads past the allocation.

  * The matched Vendor was allocated with malloc() and its Devices list head
    was only assigned once a device line was parsed, so a vendor with no
    device entries left it uninitialized and FreeVendor() walked a garbage
    pointer.

  * FreeVendor() released the device and subdevice lists but never the Vendor
    itself, leaking one per lookup for every enumerated PCI device.

  * The file handle leaked when the buffer allocation failed, ftell() and
    fread() results were unused, and several error paths leaked the Vendor or
    the not-yet-linked Device/SubDevice.

  * strncmp() compared sizeof(VendorId) bytes, which is the size of the
    pointer rather than the length of a vendor id.

  * ReadLine() passed an unclamped count to strncpy_s(), which triggers the
    invalid parameter handler for a line longer than the destination.

  * GetVendorById() ignored the GetModuleFileName() result and overwrote the
    tail of the path buffer without checking the room left in it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3C1DuhHtqK64eEkHjKCHM
2026-08-01 14:22:52 +00:00
Sina Karvandi
e5a41009f5
Merge pull request #663 from munraimix/fix/serial-resync
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
Resync the serial receiver on framing overflow instead of flooding after an unclean disconnect
2026-08-01 13:23:48 +02:00
sina
b77df6a62b remove unused serial codes
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
2026-07-29 15:02:53 +02:00
munraimix
b2b98033ef Resync libhyperdbg's serial receivers on framing overflow too
The debuggee-side hyperkd fix stops the driver flooding, but the same
delimiter-only framing with a blind retry loop also lives in the
user-mode receivers. Mirror the resync there so an unclean disconnect
does not flood the console either: KdReceivePacketFromDebuggee,
KdReceivePacketFromDebugger, and the ListeningSerialPortInDebuggee loop.
On overflow with no end-of-buffer marker, warn once per episode and
discard to the next frame boundary (bounded by SERIAL_RESYNC_MAX_BYTES)
instead of returning into the still-desynced stream.

Refs #661
2026-07-27 22:40:06 +10:00
munraimix
2cd78897c0 Resync serial stream on framing overflow instead of flooding the debuggee
When the debugger drops the serial link uncleanly mid-frame (no CLOSE_AND_UNLOAD packet), SerialConnectionRecvBuffer overflowed without an end-of-buffer marker and returned FALSE into the KD dispatch loop retry. The loop re-entered the same desynced stream, so it overflowed again at once and flooded 'buffer exceeds the buffer limitation' (and could wedge the KD driver on the next reconnect). Discard bytes to the next end-of-buffer marker to re-align, start a fresh frame, and log once per desync episode with LogWarning. Framing and protocol are unchanged.

Refs #661
2026-07-26 22:43:57 +10:00
Sina Karvandi
e806f6e6a7
Merge pull request #660 from HyperDbg/linux
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
Added unix implementation of asm-vmx-checks.asm, and made naming conv…
2026-07-25 11:12:30 +02:00
Max Raulea
bdc7a150cb Fixed bug that made script-engine segfault, explained in the porting status, so you can type commands now
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
2026-07-24 22:28:44 +02:00
Max Raulea
1a9a62a916 Forgot to add the new linux stubs to tracked files, so here it is 2026-07-24 22:10:08 +02:00
Max Raulea
2024cb9374 Build file edit for first build og hyperdbg-cli 2026-07-24 22:07:08 +02:00
Max Raulea
f938929a8c Empty Linux stub for the keystone library 2026-07-24 21:20:44 +02:00
Max Raulea
600eaa47ba update doc and added stub for vendorID pci-id.cpp file, TODO on linux 2026-07-24 21:11:23 +02:00
Max Raulea
4bf987a596 Added missing files to the CMake build file and sweeped them for the Platform functions and guarded windows only code 2026-07-24 21:06:04 +02:00
Max Raulea
d19ffdcd42 Documentation update 2026-07-24 20:02:22 +02:00
Max Raulea
5175381c73 script engine linux build complete, added undefined references with empty stubs or linux port and updated the Cmake file accordingly 2026-07-24 20:02:00 +02:00
Max Raulea
8583d99d14 Added ucpuid to CMakeList.txt and made it portable 2026-07-24 19:48:24 +02:00
Max Raulea
7ea5eb6f2b gcc enum init fix {0} -> {} 2026-07-24 19:36:31 +02:00
Max Raulea
f5f822a46f Added the hwdbg files to the cmake files and replaced the platform files, RTLzeroMemory 2026-07-24 19:21:06 +02:00
Max Raulea
7141e23aad Added unix implementation of asm-vmx-checks.asm, and made naming convention for both files. Updated the Porting status and updated the build files.
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-07-24 18:27:26 +02:00
sina
36a4f67501 update version and CHANGELOG.md
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-07-24 13:13:49 +02:00
sina
aa96eaa617 fix snprintf_s function
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-07-23 15:46:03 +02:00
Sina Karvandi
8e1288949b
Merge pull request #657 from HyperDbg/linux
Linux
2026-07-23 15:44:56 +02:00
sina
7911465b93 cleanup ucpuid command codes 2026-07-23 10:03:35 +02:00
Sina Karvandi
3feb2d18c8
Merge pull request #659 from HyperDbg/cpuid
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
Cpuid
2026-07-22 22:51:00 +02:00
Sina Karvandi
6667dcef64
Merge pull request #658 from nikzad66/cpuid
cpuid: some changes for improvement
2026-07-22 22:27:36 +02:00
Nikzad
b1b9680ce6 cpuid: some changes for improvement 2026-07-22 21:21:17 +03:30
Max Raulea
f1a923406c new linux guards
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
2026-07-22 11:46:23 +02:00
Max Raulea
6683c2dc3d New socket platform API and named-pipe linux file 2026-07-22 11:32:39 +02:00
Max Raulea
1abac35edc new email and some changes 2026-07-22 11:05:07 +02:00
Max Raulea
6f7bc287fe Guards and Documentation 2026-07-22 10:16:22 +02:00
Max Raulea
5fdd2e7738 rdmsr file and updates status 2026-07-22 10:02:29 +02:00
sina
d4132ee7db fix UInt32 convesion for negative (signed) values 2026-07-21 16:57:26 +02:00
Max Raulea
a4da625e05 fix build
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
2026-07-21 15:57:23 +02:00
Max Raulea
926070135d Sweeps and extra guards and some new platform functionsd 2026-07-21 15:53:34 +02:00
sina
f4c77abb75 update and cleanup CPUID 2 plus fixing build error 2026-07-21 15:27:22 +02:00
sina
39c4b2f127 update and cleanup CPUID 2026-07-21 15:12:04 +02:00
Sina Karvandi
6324c1d718
Merge pull request #650 from nikzad66/feature-cpuid-command
Feature cpuid command
2026-07-21 14:28:37 +02:00
Sina Karvandi
fe9a6f39e4
Merge pull request #654 from HyperDbg/linux
Some checks failed
vs2026-ci / win-amd64-build (debug, x64) (push) Has been cancelled
vs2026-ci / win-amd64-build (release, x64) (push) Has been cancelled
vs2026-ci / Deploy release (push) Has been cancelled
Linux
2026-07-21 14:05:03 +02:00
Sina Karvandi
ed51beba7c
Merge pull request #655 from xmaple555/dev
Some checks are pending
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
update variable type and add float type in script engine
2026-07-20 21:04:45 +02:00