Callback function to handle returns from the syscall.
1773{
1774
1775
1776
1777
1778
1779
1780
1782 {
1784 }
1785
1786
1787
1789 {
1790
1791
1792
1794 {
1795 FILE_BASIC_INFORMATION Buf = {0};
1796
1797
1798
1799 if (!
g_Callbacks.MemoryMapperReadMemorySafeOnTargetProcess(Params->
OptionalParam1, &Buf,
sizeof(FILE_BASIC_INFORMATION)))
1800 {
1801 LogError(
"Err, Virtual memory read failed");
1802 }
1803 else
1804 {
1805
1806
1807
1808 Buf.FileAttributes = ((
DWORD)-1);
1809
1810 if (!
g_Callbacks.MemoryMapperWriteMemorySafeOnTargetProcess(Params->
OptionalParam1, &Buf,
sizeof(FILE_BASIC_INFORMATION)))
1811 {
1812 LogError(
"Err, Virtual memory write failed");
1813 }
1814 }
1815 }
1816 else
1817 {
1818 LogInfo(
"A call for the NtQueryAttributeFile system call for a marked file was made, but the output buffer was not captured");
1819 }
1820 }
1821
1822
1823
1824
1825
1826
1828 {
1829 LogInfo(
"A NtOpenDirectoryObject system call was made for a known directory that reveals hypervisor presence. process: %x, thread: %x\n",
1830 ProcessId,
1831 ThreadId);
1832 LogInfo(
"No action to mitigate this was made as a handler for NtOpenDirectoryObject has not been implemented");
1833 }
1834
1835
1836
1838 {
1840 {
1841 case 0x07:
1842 {
1844 {
1845
1846
1847
1848 DWORD_PTR NoDebugPort = 0x0;
1849
1851 }
1852 break;
1853 }
1854 case 0x1f:
1855 {
1856
1857
1858
1859 ULONG notDebugged = 0x0;
1861 break;
1862 }
1863 case 0x1e:
1864 {
1866 {
1867 LogInfo(
"Process %llx called the NtQueryInformationProcess system call with the ProcessDebugObject class, no transparent mitigations were performed", ProcessId);
1868 }
1869 break;
1870 }
1871 default:
1872 {
1873 break;
1874 }
1875 }
1876 }
1877
1878
1879
1881 {
1882
1883
1884
1885 Regs->
rax = (UINT64)(
UINT32)STATUS_DEBUGGER_INACTIVE;
1886 }
1887
1888
1889
1890
1892 {
1893
1894
1895
1896
1897 Regs->
rax = (UINT64)(
UINT32)STATUS_OBJECT_NAME_NOT_FOUND;
1898 }
1899
1900
1901
1902
1903
1904
1905
1906
1907
1909 {
1910 UINT64 RetVal;
1911
1912
1913
1914
1916
1917
1918
1919
1920
1921
1922 if (RetVal != 0)
1923 {
1925 }
1926 }
1927
1928
1929
1931 {
1932
1933
1934
1935
1936 Regs->
rax = (UINT64)(
UINT32)STATUS_OBJECT_NAME_NOT_FOUND;
1937 }
1939 {
1940 UINT64 RetVal;
1941
1942
1943
1944
1946
1947
1948
1949
1950
1951
1952 if (RetVal != 0)
1953 {
1955 }
1956 }
1957 else
1958 {
1959
1960
1961
1962 LogInfo(
"Transparent callback for an unimplemented system call handle with the trap flag for process: %x, thread: %x, context: %llx RAX: %llx (p1: %llx, p2: %llx, p3: %llx, p4: %llx) \n",
1963 ProcessId,
1964 ThreadId,
1965 Context,
1971 }
1972}
#define LogError(format,...)
Log in the case of error.
Definition HyperDbgHyperLogIntrinsics.h:113
#define LogInfo(format,...)
Define log variables.
Definition HyperDbgHyperLogIntrinsics.h:71
UINT64 OptionalParam4
Definition DataTypes.h:346
UINT64 OptionalParam2
Definition DataTypes.h:344
UINT64 OptionalParam1
Definition DataTypes.h:343
UINT64 OptionalParam3
Definition DataTypes.h:345
UINT64 rax
Definition BasicTypes.h:141