Commit graph

2619 commits

Author SHA1 Message Date
Sina Karvandi
46098fcba1
Merge pull request #678 from HyperDbg/linux
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
Linux
2026-08-22 22:58:13 +02:00
sina
3a3b017156 Restore script-engine-test submodule pointer
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-22 22:41:01 +02:00
Nikzad
123e0dd790 fixed problem for user i/o instruction 2026-08-17 22:08:37 +03:30
Max Raulea
a5b2c13c4b fix build
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-17 15:33:46 +02:00
Max Raulea
82ad5fc9b6 Swepped hyperhv project for platform functions and swapped them 2026-08-17 15:24:25 +02:00
Sina Karvandi
fd8b9d8bc3
Merge pull request #676 from FallinBinary/dev
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
refactor dl, da and dw commands
2026-08-15 22:36:49 +02:00
Max Raulea
925c90ab26 For the WDK definitions a new file now exists to store them for the linux build 2026-08-14 18:23:38 +02:00
FallinBinary
a78b0208e4 refactor dl, da and dw commands 2026-08-14 08:52:06 -07:00
Sina Karvandi
a79dd9f6cc
Merge pull request #675 from xmaple555/dev
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
update function parameter to the script engine
2026-08-14 17:16:52 +02:00
Max Raulea
cf4b2c48e3 Windows build fix
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-14 16:56:49 +02:00
Max Raulea
a02a0a25fd Port hyperlog to the Linux kernel module
Logging.c and UnloadDll.c compile and link into HyperDbg.ko, along with
the two components that were waiting on the logging layer (BinarySearch,
OptimizationsExamples).

- new PlatformStr.{h,c}: PlatformVsnprintf/Sprintf/Strnlen replace
  vsprintf_s/sprintf_s/strnlen_s; PlatformSprintf moved here out of
  PlatformMem so both spellings return -1 on truncation
- BasicTypes.h: IRP/IO_STACK_LOCATION/IO_STATUS_BLOCK/UNICODE_STRING
  grow the members shared code touches, plus the NT status and access
  constants the notify path needs
- Environment.h: RTL_NUMBER_OF, _Analysis_assume_, ASSERT -> WARN_ON
- PlatformEvent: ExEventObjectType placeholder token
- HyperLogCallback.c stays out of the module: it defines the same
  LogCallback* entry points as Logging.c (it is the per-DLL forwarding
  shim on Windows), so in one link unit it is a duplicate symbol
2026-08-14 16:25:37 +02:00
Max Raulea
a7d6535442 Add files to the build files
Hopefully fixes build issue
2026-08-14 15:41:00 +02:00
xmaple555
c40f57efa6 update function parameter to the script engine 2026-08-14 21:40:42 +08:00
Max Raulea
4dc132937f Port components/Spinlock.c to Linux kernel module
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
Route Spinlock.c's three MSVC intrinsics through the platform
intrinsics layer instead of the Windows builtins:
  _mm_pause                 -> CpuPause (already existed)
  _interlockedbittestandset -> CpuInterlockedBitTestAndSet (new)
  InterlockedCompareExchange-> CpuInterlockedCompareExchange (new, 32-bit)

Add the two new Cpu* wrappers to the kernel PlatformIntrinsics
{.h,.c} with win + linux arms (Linux uses __atomic_* builtins,
mirroring the existing 64-bit CAS), keeping the Cpu* wrappers the
single intrinsic boundary.
2026-08-14 11:35:21 +02:00
Sina Karvandi
368f0302f4
Merge pull request #673 from HyperDbg/linux
Some checks are pending
vs2026-ci / win-amd64-build (release, x64) (push) Waiting to run
vs2026-ci / win-amd64-build (debug, x64) (push) Waiting to run
vs2026-ci / Deploy release (push) Blocked by required conditions
Linux
2026-08-13 15:01:18 +02:00
xmaple555
d8e777cd39 update test script-semantic 2026-08-12 23:01:07 +08:00
Max Raulea
2a23d05ce6 Filled in the time stubs for platformtime functions for 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
2026-08-11 13:13:07 +02:00
Max Raulea
33571e2c51 Implementationb of the platform spinlocks file for linux kernel module 2026-08-11 13:02:16 +02:00
Max Raulea
786cb1775d Filled in PlatformProcess.c for linux module build 2026-08-11 12:53:18 +02:00
Max Raulea
b0de162deb Added linux part of PlatformIrql
Added the linux part of PlatformIrql by adding preempt_enable() and preempt_disable.
2026-08-11 12:20:50 +02:00
Max Raulea
9ea26e4f8b PlatformIO stub
Empty stubs for PLatform IO and added some types to the linux build
2026-08-11 12:00:27 +02:00
Max Raulea
d64ce241f7 Added stub for the PLatform event file
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
Added a  empty stub for the event functions on linux, since they don't
have a one to one mapping. also removed some redundant guards.
2026-08-11 11:17:35 +02:00
Max Raulea
6bb174b006 linux BHqueue for windows DPC port
In order for PlatformDpc to compile on linux I stubbed out the DPC part
and made a skeleton for the linux implementation using the BHqueue.
2026-08-11 10:53:17 +02:00
Max Raulea
5d3f694942 Renamed asm-vmx-checks-gas-unix file
Renames .s to .S, this was needed because the fiel is otherwise deleted
by make clean
2026-08-11 10:33:23 +02:00
xmaple555
d53712638c revert hyperdbg-test 2026-08-11 00:23:02 +08:00
xmaple555
5fc25f10e5 add the test script-semantic CLI command 2026-08-10 23:47:40 +08:00
Sina Karvandi
80f224fa58
Merge pull request #671 from nikzad66/uin-uout-commands
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
Uin uout commands
2026-08-10 12:00:21 +02:00
sina
ffa170a964 add return for uin, uout, ucpuid exported functions 2026-08-09 21:13:11 +02:00
sina
3f0e70c575 move ucpuid, uin, and uout files 2026-08-09 20:52:41 +02:00
xmaple555
c4e82c2bfd update char and wchar_t in script engine 2026-08-09 23:24:21 +08:00
sina
c8a209d84b add different DW DA definition
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-08 16:38:16 +02:00
Sina Karvandi
b9efc41b9c
Merge pull request #666 from FallinBinary/dev
Add dw and da commands
2026-08-08 16:31:36 +02:00
Nikzad
2dfbf46e51 c/cpp files 2026-08-06 21:13:03 +03:30
Nikzad
128c9fac77 header files 2026-08-06 21:11:59 +03:30
Nikzad
535ffb1436 added uin.cpp and uout.cpp 2026-08-06 21:10:15 +03:30
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
625e75719e
Merge branch 'dev' into claude/code-audit-improvements-prdq23 2026-08-02 10:50:02 +02:00
Abolfazl
056559c0ac
Merge branch 'HyperDbg:dev' into dev 2026-08-01 21:03:50 -07:00
FallinBinary
92a8b5256b add da command 2026-08-01 21:01:47 -07: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
FallinBinary
1f50e5afe8 add dw command 2026-08-01 08:31:13 -07: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