Skip to content

Commit

Permalink
update 2021年11月17日 16:57:48
Browse files Browse the repository at this point in the history
  • Loading branch information
No-Github committed Nov 17, 2021
1 parent 9ade370 commit d79fd1a
Show file tree
Hide file tree
Showing 56 changed files with 1,414 additions and 235 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ push.sh
/assets/Temp
/1earn/Develop/*
/1earn/Security/Reverse/
/1earn/Security/PWN/
/1earn/Security/PWN/笔记/
/1earn/Security/RedTeam/Web安全/靶场/sqli-labs-WalkThrough.md
/1earn/Security/安全资源/靶机/VulnHub/symfonos/symfonos6-WalkThrough.md
/1earn/Security/RedTeam/语言安全/dotnet安全/*
Expand Down
95 changes: 52 additions & 43 deletions 1earn/Develop/Web/笔记/认证&授权.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,55 +207,64 @@ JWT 的 Token 由三部分组成,Header,Payload 与 Signature,它们之间
header.payload.signature
```
- Header
Header 对象用于标识生成签名的算法,其中 “alg” 字段表示签名的加密算法,一般默认是 HMAC SHA256,也有简称为 HS256 的。“typ”字段表示这个 Token 的类型,JWT 的 Token 统一这里填写的为“JWT”。
```json
{
"alg": "HS256",
"typ": "JWT"
}
```
## Header
- Payload
payload 为 JWT 的第二部分,其 JSON 对象包含一系列键值对(key/value),存放的是真正需要传递的数据。其中包含声明(要求)。声明是关于实体(通常是用户)和其他数据的声明。声明有三种类型: registered, public 和 private。
- Registered claims : 这里有一组预定义的声明,它们不是强制的,但是推荐。比如:iss (issuer), exp (expiration time), sub (subject), aud (audience)等。
- Public claims : 可以随意定义。
- Private claims : 用于在同意使用它们的各方之间共享信息,并且不是注册的或公开的声明,也可以随意定义。
Registered claims 有特殊含义,比如 iat、exp 等,iat 表示 JWT 生成的实际,而 exp 代表 JWT 过期的时间。开发者可以使用其他非预定义的键用于传输数据。JWT规定了以下7个官方可选字段,但并不强制使用(声明名称都是三个字符)
* iss (issuer):签发人
* exp (expiration time):过期时间
* sub (subject):主题
* aud (audience):受众
* nbf (Not Before):生效时间
* iat (Issued At):签发时间
* jti (JWT ID):编号
除了上述的7个字段,用户可以在这个部分自定义 Public claims 和 Private claims,例如:
```json
{
  "sub": "123456789",
  "name": "shiroshiro",
  "admin": false
}
```
Header 对象用于标识生成签名的算法,其中 “alg” 字段表示签名的加密算法,一般默认是 HMAC SHA256,也有简称为 HS256 的。
以上两个字段都要最后经过 Base64 编码转换成字符串后才能当做 JWT Token 使用,但要注意的是 Base64 编码是可逆的,所以说任何人都可读到这两段的内容
“typ”字段表示这个 Token 的类型,JWT 的 Token 统一这里填写的为“JWT”
- Signature
alg 为算法的缩写,typ 为类型的缩写
```json
{
"alg": "HS256",
"typ": "JWT"
}
```

signatrue,即签名,是 JWT 的第三部分。它由编码的 header 和 payload,使用用户指定的密钥 secret,采用 header 中指定的哈希算法生成
然后,这个 JSON 被 Base64 编码,形成 JSON Web Token 的第一部分

signature 是根据 payload 生成的,两者是一一对应的,这样可以保证 payload 的数据不被篡改,除非密钥 secret 泄漏。
## Payload

首先定义一个密钥,这个密钥由服务器保存,也只有服务器知道,不能泄露给用户。然后使用 Header 里面指定的签名算法生成签名,例如:
```
HMACSHA256(base64UrlEncode(header) + "." + base64UrlEncode(payload), secret)
```
算出签名后使用 '.' 连接三段字符串,这就是 JWT Token 的结构。
payload 为 JWT 的第二部分,其 JSON 对象包含一系列键值对(key/value),存放的是真正需要传递的数据。其中包含声明(要求)。声明是关于实体(通常是用户)和其他数据的声明。声明有三种类型: registered, public 和 private。
- Registered claims : 这里有一组预定义的声明,它们不是强制的,但是推荐。比如:iss (issuer), exp (expiration time), sub (subject), aud (audience)等。
- Public claims : 可以随意定义。
- Private claims : 用于在同意使用它们的各方之间共享信息,并且不是注册的或公开的声明,也可以随意定义。

Registered claims 有特殊含义,比如 iat、exp 等,iat 表示 JWT 生成的实际,而 exp 代表 JWT 过期的时间。开发者可以使用其他非预定义的键用于传输数据。JWT规定了以下7个官方可选字段,但并不强制使用(声明名称都是三个字符)
* iss (issuer):签发人
* exp (expiration time):过期时间
* sub (subject):主题
* aud (audience):受众
* nbf (Not Before):生效时间
* iat (Issued At):签发时间
* jti (JWT ID):编号

除了上述的7个字段,用户可以在这个部分自定义 Public claims 和 Private claims,例如:

```json
{
  "sub": "123456789",
  "name": "shiroshiro",
  "admin": false
}
```

以上两个字段都要最后经过 Base64 编码转换成字符串后才能当做 JWT Token 使用,但要注意的是 Base64 编码是可逆的,所以说任何人都可读到这两段的内容。

## Signature

signatrue,即签名,是 JWT 的第三部分。它由编码的 header 和 payload,使用用户指定的密钥 secret,采用 header 中指定的哈希算法生成。

signature 是根据 payload 生成的,两者是一一对应的,这样可以保证 payload 的数据不被篡改,除非密钥 secret 泄漏。

首先定义一个密钥,这个密钥由服务器保存,也只有服务器知道,不能泄露给用户。然后使用 Header 里面指定的签名算法生成签名,例如:
```
HMACSHA256(base64UrlEncode(header) + "." + base64UrlEncode(payload), secret)
```

然后将这部分 base64 编码形成 JSON Web Token 第三部分

算出签名后使用 '.' 连接三段字符串,这就是 JWT Token 的结构。

---

Expand Down
1 change: 1 addition & 0 deletions 1earn/Integrated/Linux/Power-Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -4699,6 +4699,7 @@ PATH=$PATH:/usr/local/python3/bin/
```bash
source ~/.bash_profile
```
检查 Python3 及 pip3 是否正常可用
```bash
python3 -V
Expand Down
14 changes: 14 additions & 0 deletions 1earn/Integrated/Linux/Speed-Linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ gedit # 图形化的编辑器
按下 / 即可进入查找模式,输入要查找的字符串并按下回车. Vim 会跳转到第一个匹配.按下 n 查找下一个,按下 N 查找上一个.
:%s/foo/bar # 代表替换 foo 为 bar
insert 模式按 ESC 键,返回 Normal 模式

vim -r xxx.swp # 恢复上次异常退出的文件
```
- **更多操作**
- [Vim](./Power-Linux.md#Vim)
Expand Down Expand Up @@ -903,6 +905,12 @@ ln file1 file2
ar -p FileName.deb data.tar.gz | tar zxf - # 解包
```

- asar
```bash
npm install --engine-strict asar
asar e xxx.asar xxx # 解包
```

**7z**
```bash
apt install -y p7zip
Expand Down Expand Up @@ -1346,7 +1354,13 @@ iptables -A INPUT -p tcp -s 0.0.0.0/0 --dport 22 -j DROP

iptables -L # 查看防火墙规则
iptables-restore </root/firewall_rules.backup # 恢复规则

# 以下为清除所有策略并允许所有流量通过防火墙。这和你停止防火墙效果一样,生产环境请不要使用
iptables -F # 清除防火墙配置
iptables -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
```

### ufw
Expand Down
61 changes: 61 additions & 0 deletions 1earn/Integrated/Windows/PowerShell/PowerShell笔记.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,62 @@ Windows PowerShell 需要用于管理 .NET 对象的语言.该语言需要为使
---
# 安装Powershell
https://docs.microsoft.com/zh-cn/powershell/scripting/install/installing-powershell-on-windows
## 支持的 Windows 版本
* ✅ 指示仍支持 OS 或 PowerShell 版本
* ❌ 指示不支持 OS 或 PowerShell 版本
* 💢 指示该 OS 版本不再支持 PowerShell 版本
| Windows版本 | 7.0 (LTS) | 7.1(最新版) | 7.2 (LTS-preview) |
| - | - | - | - |
| Windows Server 2016,2019,2022 | ✅ | ✅ | ✅ |
| Windows Server 2012 R2 | ✅ | ✅ | ✅ |
| Windows Server Core(2012 R2) | ✅ | ✅ | ✅ |
| Windows Server Nano(1809) | ✅ | ✅ | ✅ |
| Windows Server 2012 | 💢 | ❌ | ❌ |
| Windows Server 2008 R2 | 💢 | ❌ | ❌ |
| Windows 11 | ✅ | ✅ | ✅ |
| Windows 10 1607 | ✅ | ✅ | ✅ |
| Windows 8.1 | ✅ | ✅ | ❌ |
以下处理器体系结构在 Windows 上支持 PowerShell。
| Windows版本 | 7.0 (LTS) | 7.1(最新版) | 7.2 (LTS-preview) |
| - | - | - | - |
| Nano Server 1803 | x64、Arm32 | X64 | X64 |
| Windows Server 2012 R2 | x64、x86 | x64、x86 | x64、x86 |
| Windows Server Core 2012 R2 | x64、x86 | x64、x86 | x64、x86 |
| Windows 10 or 11 | x64、x86 | x64、x86、Arm64 | x64、x86、Arm64 |
| Windows 8.1 | x64、x86 | x64、x86 | x64、x86 |
---
# 使用
**PS1文件**
一个 PowerShell 脚本其实就是一个简单的文本文件, 这个文件包含了一系列 PowerShell 命令,每个命令显示为独立的一行,对于被视为 PowerShell 脚本的文本文件,它的文件名需要加上 .PS1 的扩展名。
**PowerShell的执行策略**
为防止恶意脚本的执行,PowerShell有一个执行策略,默认情况下,这个执行策略被设置为受限。
我们可以使用:Get-ExecutionPolicy 命令查看PowerShell当前的执行策略。它有4个策略。
* Restricted:脚本不能运行(默认设置)
* RemoteSigned:本地创建的脚本可以运行,但是从网上下载的脚本不能运行(拥有数字证书签名的除外)
* AllSigned:仅当脚本由受信任的发布者签名时才能运行;
* Unrestricted:允许所有的脚本执行
```
Set-ExecutionPolicy 策略名(如:Unrestricted)
```
---
# 常用命令
> 本部分内容由 [xidaner](https://github.com/xidaner) 提供,在此只做排版修改
Expand Down Expand Up @@ -78,6 +134,11 @@ Remove-Item C:\tobedeleted -Recurse

## 收集信息

查看当前Powershell版本
```powershell
$PSVersionTable
```

获取计算机组成或模型信息
```powershell
Get-WmiObject -Class Win32_ComputerSystem
Expand Down
3 changes: 2 additions & 1 deletion 1earn/Integrated/Windows/笔记/认证.md
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ SPN 的格式:
为了解决无约束委派的隐患,微软发布了约束委派(S4U2Proxy)。
若服务 A 允许委派给服务B,则 A 能使用 S4U2Proxy 协议将用户发送的 TS(图中的 TGS,TGS 必须是可转发的) 再转发给域控制器认证,为用户请求访问服务 B 的 TS(图中的 TGS)。接着,服务 A 就能使用新获得的 TS(图中的 TGS模拟用户访问服务 B:
若服务 A 允许委派给服务B,则 A 能使用 S4U2Proxy 协议将用户发送的 TS(图中的 TGS,TGS 必须是可转发的) 再转发给域控制器认证,为用户请求访问服务 B 的 TS(图中的 TGS)。接着,服务 A 就能使用新获得的 TS(图中的 TGS)模拟用户访问服务 B:
![](../../../../assets/img/Integrated/Windows/笔记/认证/17.png)
Expand Down Expand Up @@ -1152,3 +1152,4 @@ SPN 的格式:
- [红队与理论:Credential Relay 与 EPA](https://mp.weixin.qq.com/s/hACLQ4UgdFXDdlB4CKKhXg)
- [NTLM Relay](https://en.hackndo.com/ntlm-relay/)
- [你并不懂 Mimikatz Part 2 - MSCACHE](https://mp.weixin.qq.com/s/mTpYcHebvlERj9ek2_Pu8Q)
- [一文读懂Kerberos认证流程](https://mp.weixin.qq.com/s/tXqKHbygwyE-TgVLWkYQjw)
8 changes: 8 additions & 0 deletions 1earn/Plan/Misc-Plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,11 @@ ffmpeg -y -i in.out -vcodec xvid -s 176x144 -r 29.97 -b 1500 -acodec aac -ac 2 -
**关闭晃动窗口最小化**
运行 gpedit.msc 打开组策略编辑器,展开 用户配置 -> 管理模版 -> 桌面,可以在右边区域找到 “关闭 Aero Shake 窗口最小化鼠标手势” 的项目,它的默认状态为 “未配置”,在未配置的情况下,Aero Shake 的功能是默认开启的, 设置为“已启用” 即可
**audiodg 无响应**
```
psexec.exe -accepteula -s -i -d cmd.exe
net stop audiosrv
net start audiosrv
```
1 change: 1 addition & 0 deletions 1earn/Security/BlueTeam/分析.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ YARA 是一款旨在帮助恶意软件研究人员识别和分类恶意软件样

- [服务器真的没有异常吗?挖矿病毒Skidmap伪造CPU使用率](https://mp.weixin.qq.com/s/oPkhFa4s0Rhg1ypf76hLew)
- [Offensive OSINT s01e02 - Deobfuscation & Source code analysis + uncovering CP distribution network](https://www.offensiveosint.io/offensive-osint-s01e02-deobfuscation-source-code-analysis-uncovering-cp-distribution-network/)
- [新·8220挖矿团伙样本分析报告](https://mp.weixin.qq.com/s/rvLyvgTHDqGYwq4hVRMcmw)
3 changes: 2 additions & 1 deletion 1earn/Security/BlueTeam/取证.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ CRC 校验实用程序库,在数据存储和数据通讯领域,为了保证
stegoveritas test.png
```
- OurSecret

**writup**
- [[IceCTF 2016] [Stega 100 - Pretty Pixels] Write Up](https://0x90r00t.com/2016/08/26/icectf-2016-stega-100-pretty-pixels-write-up/) - 知识点 : 图片隐写
Expand Down Expand Up @@ -604,7 +605,7 @@ montage flag*.png -tile x1 -geometry +0+0 a.png
- [PDF Parser](https://github.com/smalot/pdfparser)
- [Demo | PDF Parser](https://www.pdfparser.org/demo)
- [jesparza/peepdf](https://github.com/jesparza/peepdf)
- [wbStego4.3open](http://www.bailer.at/wbstego/pr_4ix0.htm)
- [wbStego4.3open](http://www.bailer.at/wbstego/pr_4ix0.htm) - BMP、RLE、TXT、ASC、XML、PDF、HTML 格式都有可能
- wbStego4open 会把插入数据中的每一个 ASCII 码转换为二进制形式,然后把每一个二进制数字再替换为十六进制的 20 或者 09,20 代表 0,09 代表 1。这些转换后的十六进制数据被嵌入到 PDF 文件中。查看用 wbStego4open 修改后的文件内容,会发现文件中已混入了很多由 20 和 09 组成的 8 位字节。
- pdfinfo - kali 自带
```bash
Expand Down
31 changes: 30 additions & 1 deletion 1earn/Security/BlueTeam/实验/流量分析.md
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,8 @@ USB 协议的数据部分在 Leftover Capture Data 块中
鼠标发送 00 03 0b 00 ,表示鼠标右移 03 像素,垂直向上移动 11 像素.
> 注意 : 有线鼠标和无线鼠标流量是不一样的
### 键盘流量
USB 协议的数据部分在 Leftover Capture Data 块中
Expand All @@ -695,7 +697,7 @@ USB 协议的数据部分在 Leftover Capture Data 块中
---
## 其他私有协议
## 其他
### TeamViewer
Expand All @@ -711,3 +713,30 @@ USB 协议的数据部分在 Leftover Capture Data 块中
**lua插件**
- https://docs.google.com/file/d/0B3tHnfnS08GyWjJUOXE3UGFJRnc/edit
### CobaltStrike
**相关文章**
- [Cobalt Strike: Using Known Private Keys To Decrypt Traffic – Part 2](https://blog.nviso.eu/2021/10/27/cobalt-strike-using-known-private-keys-to-decrypt-traffic-part-2/)
- [破解版密钥相同,部分CobaltStrike加密流量可解](https://mp.weixin.qq.com/s/AcIFSjyqn9gzyRkyx3sRIQ)
**相关工具**
- https://blog.didierstevens.com/2021/10/22/new-tool-cs-decrypt-metadata-py/
- https://blog.didierstevens.com/2021/10/11/update-1768-py-version-0-0-8/
- https://github.com/DidierStevens/Beta/blob/master/cs-parse-http-traffic.py
**案例**
用 1768.py 分析 beacon.exe 源文件
![](../../../../assets/img/Security/BlueTeam/实验/流量分析/85.png)
抓包,用 cs-decrypt-metadata.py 解密 cookie
![](../../../../assets/img/Security/BlueTeam/实验/流量分析/86.png)
![](../../../../assets/img/Security/BlueTeam/实验/流量分析/87.png)
用 cs-parse-http-traffic 解密
![](../../../../assets/img/Security/BlueTeam/实验/流量分析/88.png)
14 changes: 12 additions & 2 deletions 1earn/Security/BlueTeam/监察.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
**相关工具**
- [云锁](https://www.yunsuo.com.cn/)
- [Sysmon](../安全工具/Sysmon.md)
- [huoji120/CobaltStrikeDetected](https://github.com/huoji120/CobaltStrikeDetected) - 40行代码检测到大部分CobaltStrike的shellcode
- [huoji120/CobaltStrikeDetected](https://github.com/huoji120/CobaltStrikeDetected) - 40 行代码检测到大部分 CobaltStrike 的 shellcode

---

Expand Down Expand Up @@ -126,6 +126,8 @@
- [快速安装可视化IDS系统Security Onion](https://blog.51cto.com/chenguang/1783994)
- [入侵检测系统security onion](https://www.jianshu.com/p/a3541ee96f46)
- [Security Onion介绍](https://zhuanlan.zhihu.com/p/34072611)
- [bytedance/Elkeid](https://github.com/bytedance/Elkeid)
- [404星链计划 | 抗击黑客:如何利用Elkeid构建入侵检测能力](https://mp.weixin.qq.com/s/iwvkIdgMblVOH7Agg_wXtQ)

**规则库**
- [ptresearch/AttackDetection](https://github.com/ptresearch/AttackDetection) - 常见 cve 漏洞的规则库
Expand All @@ -152,13 +154,14 @@
- [SSL 指纹识别和绕过](https://ares-x.com/2021/04/18/SSL-%E6%8C%87%E7%BA%B9%E8%AF%86%E5%88%AB%E5%92%8C%E7%BB%95%E8%BF%87/)
- [【技术分享】反制爬虫之Burp Suite RCE](https://mp.weixin.qq.com/s/FHvvUOLskvQ9QqVMboU8ng)
- [端内钓鱼,反制蚁剑](https://mp.weixin.qq.com/s/5zEzHo1I2xKdweb_vREWgg)
- [闲来无事,反制GOBY](https://mp.weixin.qq.com/s/EPQZs5eQ4LL--tao93cUfQ)

**反制扫描工具**
- [alexzorin/cve-2021-34558](https://github.com/alexzorin/cve-2021-34558)

**mysql反制**
- [Gifts/Rogue-MySql-Server](https://github.com/Gifts/Rogue-MySql-Server)
- [BeichenDream/MysqlT](https://github.com/BeichenDream/MysqlT) - 伪造Myslq服务端,并利用Mysql逻辑漏洞来获取客户端的任意文件反击攻击者
- [BeichenDream/MysqlT](https://github.com/BeichenDream/MysqlT) - 伪造 Myslq 服务端, 并利用 Mysql 逻辑漏洞来获取客户端的任意文件反击攻击者

**网络协议生成器**
- [fofapro/fapro](https://github.com/fofapro/fapro)
Expand All @@ -169,6 +172,13 @@
---
## 篡改监测
**相关工具**
- [rabbitmask/Libra](https://github.com/rabbitmask/Libra)
---
# 业务层面
## 认证
Expand Down
Loading

0 comments on commit d79fd1a

Please sign in to comment.