Overview
SysWhispers4 provides NT-level file I/O functions that bypass user-mode hooks onkernel32.dll file functions like CreateFile, ReadFile, WriteFile, etc.
NtCreateFile
Creates or opens a file.Parameters
Pointer to variable that receives the file handle.
Access rights:
FILE_READ_DATA(0x0001)FILE_WRITE_DATA(0x0002)FILE_APPEND_DATA(0x0004)GENERIC_READ(0x80000000)GENERIC_WRITE(0x40000000)
Pointer to
OBJECT_ATTRIBUTES structure containing the file path:Pointer to
IO_STATUS_BLOCK structure that receives I/O status.Initial allocation size. Use
NULL for default.File attributes:
FILE_ATTRIBUTE_NORMAL(0x80)FILE_ATTRIBUTE_HIDDEN(0x02)FILE_ATTRIBUTE_READONLY(0x01)
Sharing mode:
FILE_SHARE_READ(0x01)FILE_SHARE_WRITE(0x02)FILE_SHARE_DELETE(0x04)0for exclusive access
Action to take:
FILE_SUPERSEDE(0) — Replace if existsFILE_OPEN(1) — Open existing (fail if not exists)FILE_CREATE(2) — Create new (fail if exists)FILE_OPEN_IF(3) — Open existing or createFILE_OVERWRITE(4) — Overwrite existingFILE_OVERWRITE_IF(5) — Overwrite or create
Options:
FILE_SYNCHRONOUS_IO_NONALERT(0x20) — Synchronous I/OFILE_NON_DIRECTORY_FILE(0x40) — Must be a fileFILE_DELETE_ON_CLOSE(0x1000) — Delete when closed
Extended attributes buffer (usually
NULL).Extended attributes length (usually
0).Example: Create and Write File
NtOpenFile
Opens an existing file (simpler thanNtCreateFile).
Example
NtReadFile
Reads data from a file.Parameters
Handle to the file (from
NtOpenFile or NtCreateFile).Optional event handle to signal on completion (use
NULL for synchronous).Optional APC routine (use
NULL).Optional APC context (use
NULL).Receives I/O status. Check
iosb.Information for bytes read.Buffer that receives the data.
Number of bytes to read.
File offset to read from. Use
NULL to read from current position.Optional file key (use
NULL).Example
NtWriteFile
Writes data to a file.Example
NtDeleteFile
Deletes a file.Example
NT Path Format
Conversion Table
Helper: Convert Win32 to NT Path
Complete Example: File Dropper
Drop a file to disk via syscalls:Advantages Over Win32 File APIs
Next Steps
Token Functions
Token manipulation and privilege escalation
Evasion Helpers
ETW bypass, AMSI bypass, unhooking
