1

【Pwn 笔记】Linux 命令注入一览

 2 years ago
source link: https://binlep.github.io/2020/03/24/%E3%80%90Pwn%20%E7%AC%94%E8%AE%B0%E3%80%91Linux%20%E5%91%BD%E4%BB%A4%E6%B3%A8%E5%85%A5%E4%B8%80%E8%A7%88/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

【Pwn 笔记】Linux 命令注入一览

骚操作总结,咕咕咕式更新

能够起 shell 的命令

setarch

# setarch --list
uname26
linux32
linux64
i386
i486
i586
i686
athlon
x86_64
setarch athlon

有些架构可以作为命令使用,终端直接输入架构名即可,可用列表如下:

linux32
linux64
i386
x86_64

后面直接加 sh 来提权,可以用于只过滤第一个命令的时候

cautious-launcher

这个命令相当于 exec

cautious-launcher /bin/sh

读取文件的命令

无需多说,用法:

cat flag
tac flag
xxd flag

这里参数加个 -tc 更好,od 比 xxd 好在 od 的后面能加 * 来实现所有文件的输出

od flag

执行无执行权限的程序

这里说的是不能使用 chmod 的情况,即不在一个用户组的情况

64位:
/lib64/ld-linux-x86-64.so.2 /readflag
32位:
/lib/ld-linux.so.2 /readflag

获取当前目录的路径

这个是常规方法,没啥可说

ls -ali
total 8
1968846 drwxr-xr-x 2 1000 1000 4096 Jan 27 12:50 .
1968682 drwxrwxrwx 152 0 0 4096 Jan 27 12:50 ..

比如我要找 inode 值为 1968846 的目录

ls -lai /tmp | grep 1968846
1968846 drwxr-xr-x 2 1000 1000 4096 Jan 27 12:50 0x8eb79f31

即可确定该目录路径为/tmp/0x8eb79f31


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK