当前位置:网站首页>101012分页
101012分页
2022-04-22 06:19:00 【Misaka10046】
WIN7 X86修改为 101012分页
cmd管理员权限
bcdedit /deletevalue {current} PAE
bcdedit /deletevalue {current} nx
bcdedit /set {current} nx AlwaysOff
bcdedit /set {current} PAE ForceDisable
修改完后就是这个效果


寻址
#include "stdafx.h"
#include "windows.h"
DWORD g = 1000;
void _tmain(int argc, _TCHAR* argv[])
{
printf("&g=0x%x\n\r",&g);
system("pause");
}
首先!process 0 0找到该进程的CR3的值

然后根据地址值进行拆分
405000
0000 0000 0100 0000 0101 0000 0000 0000
0000 0000 01 = 1
00 0000 0101 = 5
0000 0000 0000 = 0

然后根据拆分的找到数据存放位置

0地址调用函数
这个除了可以给自己的0地址挂上物理页,还可以给其他进程的0地址挂上物理页,实现一波进程的劫持。
#include "stdafx.h"
#include "windows.h"
typedef void (_stdcall *FUNCTION)();
int _tmain(int argc, _TCHAR* argv[])
{
char buf[]={
0x6A, 0x00,
0x6A, 0x00,
0x6A, 0x00,
0x6A, 0x00,
0xE8, 0x28, 0x3C, 0xC6, 0x9A,
0xC3
};//构造机器码
int *p = (int *)VirtualAlloc(NULL,0X1000,MEM_COMMIT,PAGE_EXECUTE_READWRITE) ;//在空指针的地方申请内存
VirtualLock(p,0X1000);
*((ULONG*)&buf[9])=(ULONG)MessageBoxA;//调用函数
memcpy_s(p,0x1000,buf,sizeof(buf));
//char MessageBoxAA[]={"MessageBoxA"};
//HMODULE hmodule = LoadLibraryA("user32.dll");
//ULONG messageBox = (ULONG)GetProcAddress(hmodule,MessageBoxAA);
//*(PULONG)&bufcode[9] = messageBox;也可以这样寻址
printf("address: %p\n",p);
system("pause");
HMODULE h=LoadLibraryA("ntdll.dll");
FUNCTION obj=(FUNCTION)GetProcAddress(h,"asdasd");//返回空指针
obj();
VirtualUnlock(p,0x1000);
VirtualFree(p,0X1000,MEM_DECOMMIT);
system("pause");
return 0;
}
首先找到存放机器码的位置,然后拆分地址
000F 0000
0000 0000 0000 1111 0000 0000 0000 0000
0000 0000 00 = 0
00 1111 0000 = F0
0000 0000 0000 = 0

根据拆分的找到存放机器码的位置

把机器码的位置放进0地址的位置

最后实现成功调用

分析MmIsAddressValid函数
文件为ntoskml.exe
a1 为传进去的虚拟地址
bool __fastcall sub_489B98(unsigned int a1)
{
int v1; // eax
int v3; // eax
v1 = *(_DWORD *)(((a1 >> 20) & 0xFFC) - 0x3FD00000);//这一步算出相对于PDE 0xC0300000的偏移
if ( !(v1 & 1) )//检测P位
return 0;
if ( (v1 & 0x80u) != 0 )//检测G位,如果是全局页那么是在TLB中
return 1;
v3 = *(_DWORD *)(((a1 >> 10) & 0x3FFFFC) - 0x40000000);//根据偏移算出在PTE 0xC0000000中的位置
if ( !(v3 & 1) )//检测p位
return 0;
return (v3 & 0x80) != 0x80u;//检测G位
}
PDE = 0xc0300000 + addr的高10位4
PTE = 0xC0000000 + addr的高20位4
版权声明
本文为[Misaka10046]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Misaka10046/article/details/116282619
边栏推荐
- Codeforces Round #780 (Div. 3)
- Abstract classes and abstract methods
- L2-001 emergency rescue (extension of shortest Dijkstra - number of shortest paths & maximum weight of paths)
- SUCTF 2019 EasySQL
- 437. Path sum III
- [solution] Luogu p6186 [noi online 1 improvement group] bubble sorting: [bubble sorting] and [reverse order pair] problems
- 363 · rainwater connection
- 296 · array de duplication
- Codeforces Round #634 (Div. 3)
- Hand tearing algorithm -- LRU cache elimination strategy, asked so often
猜你喜欢

A. Weird flecks, but OK (Computational Geometry & three-dimensional minimum circle coverage) (the first game of 2021 Training Alliance warm-up training competition)

Use of ansible

Addition, deletion and search of sequence table (find)

L2-002 链表去重(测试点1的坑)

B. Ball Dropping (简单几何计算 / 相似三角形) (2021牛客暑期多校训练营1)

L1-064 AI core code valued at 100 million (20 points) has wrong format

Leetcode - 8 - (sum of three numbers, zigzag transformation, sum of two numbers < linked list >, container with the most water, letter combination of telephone number)

Quick sort and merge sort

驱动与R3的通信

VAD 虚拟内存
随机推荐
Definition and difference between rewriting and overloading
下面这段SQL能否用索引优化查询性能
系统日志文件过大优化
278 · draw fill
Explanation and use of interface
843 · 数字翻转
Links summary qwq
Instructions and examples of instanceof
Can the following SQL optimize query performance with index
X64基础(一)
L1-064 估值一亿的AI核心代码 (20 分) 格式错误
323 · string game
L2-001 emergency rescue (extension of shortest Dijkstra - number of shortest paths & maximum weight of paths)
Quick sort and merge sort
296 · array de duplication
E.Figure Skating (字符串排序/签到) (2021年度训练联盟热身训练赛第五场 )
A.Binary Seating (概率) (2021年度训练联盟热身训练赛第五场)
驱动与R3的通信
Codeforces Round #779 (Div. 2)
Kotlin学习一、作用域函数let、with、run、apply、also