Skip to content

Commit

Permalink
3
Browse files Browse the repository at this point in the history
  • Loading branch information
Shangu committed May 22, 2024
1 parent 5aaf78d commit 45fbc4a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/Pwn/gdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ gcc -O1 main.c -o main.out

**扫描程序–>语法分析–>语义分析–>源代码优化–>代码生成器–>目标代码优化;**

### 保护机制

> NX:-z execstack / -z noexecstack (关闭 / 开启) 不让执行栈上的数据,于是JMP
> ESP就不能用了
> Canary:-fno-stack-protector /-fstack-protector /
> -fstack-protector-all (关闭 / 开启 / 全开启) 栈里插入cookie信息
> PIE:-no-pie / -pie (关闭 / 开启) 地址随机化,另外打开后会有get_pc_thunk
> RELRO:-z norelro / -z lazy / -z now (关闭 / 部分开启 / 完全开启) 对GOT表具有写权限
## 验证调试

:book:test1:
Expand Down Expand Up @@ -107,3 +116,15 @@ int main(void){
> 2、画出栈结构变化
> 3、劫持程序流
# 调试步骤

开启可执行权限:

```bash
chmod +x pwn
gdb pwn
b main
r
b *0x8049219
```

0 comments on commit 45fbc4a

Please sign in to comment.