首页
社区
课程
招聘
[原创]二进制入门-程序误用(ASU CSE466: Computer Systems Security)
2023-5-26 18:05 6471

[原创]二进制入门-程序误用(ASU CSE466: Computer Systems Security)

2023-5-26 18:05
6471

前言:

网上的二进制入门资源虽然有很多,但是梯度感觉变化太大,不太适合小白入门学习,这里分享一个国外的课程配套刷题网站,本文记录了第一个模块的题的通关记录以及值得记录的知识点,通过这个模块的学习,我们可以基本上能对Linux下的一些常用命令有些了解,在刷题的过程中我们也会对系统安全有了进一步的理解。

(ASU CSE466: Computer Systems Security)

Linux命令行:程序误用,程序交互
Shellcoding:汇编,shellcode注入,预防
逆向工程:功能框架,静态/动态逆向工具
程序利用:劫持到shellcode, JIT喷雾
系统开发:内核模块,权限升级
杂项:沙箱,内存错误,竞争条件
课程网站:https://pwn.college/
image.png
网站上是支持在线开启一个在线的容器,就是模拟出一个Linux系统,但是操作起来太卡,我们可以通过ssh的方式进行连接,首先生成自己的rsa_key,然后复制到网站上的个人信息一栏,就可以通过以下命令来进行连接了。
ssh -i key hacker@dojo.pwn.college
image.png
(2):https://gtfobins.github.io/gtfobins这个是一个可以查询Linux下命令存在危险行为的网站,网站里面有详细的介绍和利用,对于我们接下来的做题是很有用的.
image.png

Program Misuse:

level1:

image.png

level10:
1
rev

image.png

level17

image.png
或许我们应该知道zcat这个命令:
image.png
image.png

level18:

image.png
At the begining,I try the command"bzcat":
image.png
Actually:
image.png

level19:

image.png

level20:
1
2
-O:
Outputs the extracted content to standard output instead of extracting the file to disk.

image.png

level21:

image.png
我们应该创建静态库文件:
image.png
After:

1
2
command:
p            - print file(s) found in the archive

image.png

level22:

image.png

level23:

image.png

level24:

image.png
image.png
image.png

level25:

image.png

level26:

image.png
image.png

level27:

image.png
image.png

level28:

image.png

level29:

image.png

level30:

image.png

level31:

image.png

level32:

image.png
image.png

File read
 

image.png
更多的信息和介绍我们可以看这里:https://gtfobins.github.io/gtfobins/socat/

level33:

image.png
image.png
数字是窗口的大小,我们可以通过改变数字:
image.png
image.png

level34:

image.png
image.png

level35:

image.png
image.png

level36:

image.png
image.png
image.png

level37:

image.png
image.png
image.png

level38:

image.png
image.png

level39:

image.png
At first,I try:
image.png
正确的方法:(也许你应该了解“/dev/stdout”是什么。)
image.png

level40:

image.png

思路利用详解:
 

https://medium.com/workindia-in/the-dark-side-of-mv-command-3419c1bd619
简介:我们可以通过交换“mv”和“cat”
image.png

level41:

image.png
image.png
“-n”选项逐行读取文件,“-e”选项在命令行上执行Perl代码

level42:

image.png
image.png

level43:

image.png
Owing to:
image.png

Attention:
 

我们可以在tmp目录下编写脚本:
image.png
So we can solve it by:
image.png

1
2
3
#!/usr/bin/env ruby
content = File.read("/flag")
puts content
level44:

image.png
image.png
image.png

level45:

image.png
image.png
image.png
level46:
image.png
image.png

level47:

image.png
image.png

level48:

image.png
image.png
image.png

level49:

image.png
image.png

level50:

image.png

 

此方法不区分大小写,直接输出小写:
image.png
image.png
You will find the difference:
image.png

level51(Medium):

image.png
image.png

1
2
3
4
-D pkcs11
  Download the public keys provided by the PKCS#11 shared library pkcs11. 
  When used in combination with -s, this option indicates that
  a CA key resides in a PKCS#11 token (see the CERTIFICATES section for details).

共享库
我们创建了一个测试文件:test.c,得到:
image.png
image.png
We failed:
image.png
Attention:
image.png
image.pngimage.png
image.png

1
2
3
4
5
6
7
8
#include<stdio.h>
int main(int argc,char const * argv){
   puts("Hello");
   return 0;
}
int C_GetFunctionList(){
   puts("Hi");
}

image.png
Exploit:

1
2
3
4
5
6
7
8
#include<stdio.h>
int main(int argc,char const * argv){
   puts("Hello");
   return 0;
}
int C_GetFunctionList(){
  sendfile(1,open("/flag",0),0,4096);
}

Or:

1
2
3
4
5
6
7
8
9
#include<stdio.h>
int main(int argc,char const * argv){
   puts("Hello");
   return 0;
}
__attribute__((constructor))
int my_fun(){
  sendfile(1,open("/flag",0),0,4096);
}

[培训]二进制漏洞攻防(第3期);满10人开班;模糊测试与工具使用二次开发;网络协议漏洞挖掘;Linux内核漏洞挖掘与利用;AOSP漏洞挖掘与利用;代码审计。

最后于 2023-5-29 14:41 被SKY987451编辑 ,原因:
收藏
点赞0
打赏
分享
最新回复 (1)
雪    币: 29414
活跃值: (18685)
能力值: (RANK:350 )
在线值:
发帖
回帖
粉丝
kanxue 8 2023-5-26 18:37
2
0
图床有问题,没显示出来
游客
登录 | 注册 方可回帖
返回