strikoder/LinEnum-ng

GitHub: strikoder/LinEnum-ng

LinEnum-ng 是一款针对 OSCP 优化的 Linux 提权枚举脚本,自动化检测内核漏洞和配置错误以简化渗透测试流程。

Stars: 8 | Forks: 2

# ple, if I output "LinEnum-ng", it's not Chinese. I should translate the meaning. Perhaps "LinEnum-ng" is the name of a script, so in Chinese, it might be referred to as "LinEnum-ng 脚本" or something, but the heading is just "LinEnum-ng". Looking back at the example: "API Reference" -> "API 参考", which is a mix. So, for "LinEnum-ng", I think I should keep it as "LinEnum-ng" and not translate it further. But to have it in Chinese, I can output "LinEnum-ng" as is, but that might not be a translation. I need to decide.

## 为什么选择 LinEnum-ng? 该领域有两个知名工具:原版 **LinEnum** 和 **linPEAS**。LinEnum-ng 的诞生,是因为在 OSCP 风格的实战中,这两者都无法完全满足需求。 ### 与 LinEnum 对比 ([@rebootuser](https://github.com/rebootuser/LinEnum)) LinEnum 是经典之作。它能用、简单,并且历史悠久。但它也显露出了时代的痕迹: | | LinEnum | LinEnum-ng | |---|---|---| | 内核 CVE 检查 | ❌ 无 | ✅ PwnKit、Dirty Pipe、Dirty COW、Baron Samedit、eBPF、sudo CVEs | | SUID 利用提示 | ❌ 仅列出 | ✅ 交叉引用完整 GTFOBins 列表并附说明 | | 容器检测 | ⚠️ 仅 Docker | ✅ Docker、LXC、**Kubernetes**(含 token/API 检查) | | 带密码的 Sudo | ⚠️ 交互式提示 | ✅ 通过 `-p` 标志传递,非交互式 | | 用户名查找 | ❌ | ✅ `-u` 标志:按名称和内容查找文件 | | 用户组提权 | ⚠️ 基础 | ✅ Docker、LXD、disk、adm、shadow、video — 每项都附有利用步骤 | | 彩色输出 | ❌ | ✅ linPEAS 风格的配色方案 | | 密码喷射提示 | ❌ | ✅ 提醒你对所有用户尝试已找到的密码 | ### 与 linPEAS 对比 linPEAS 功能强大且积极维护——可以说是现有功能最丰富的 Linux 信息收集脚本。LinEnum-ng 并非要取代它。此脚本存在的原因更为具体: **linPEAS 不同版本间变化太大。** 如果你做过足够多的 OSCP 靶机,你就遇到过这种情况:一个特定版本的 linPEAS 能立即找到攻击向量,然后你更新版本后,下一个版本却完全漏掉了(我在考试中就遇到过这种情况),输出结构重组,噪音水平改变。 LinEnum-ng 刻意保持稳定和范围明确。它精确覆盖了 OSCP 考试环境倾向于测试的内容: - 内核漏洞(带有版本特定的 CVE 匹配) - Sudo 配置错误(免密和需凭据) - SUID/SGID 二进制文件与 GTFOBins 交叉引用 - Cron 任务弱点 - 可写路径和服务文件 - 在配置文件、历史文件和环境变量中搜索凭据 - 容器逃逸路径 - 基于用户组的提权(docker、lxd、disk、adm、shadow) 输出简洁、彩色编码且结构化,使你可以从上到下快速进行分类处理——没有信息过载,无需在绿色文本墙中艰难搜寻。 ## 功能特性 - **内核 CVE 检测(附链接)** — PwnKit (CVE-2021-4034)、Dirty Pipe (CVE-2022-0847)、Dirty COW (CVE-2016-5195)、Baron Samedit (CVE-2021-3156)、eBPF (CVE-2017-16995)、sudo CVEs (CVE-2019-18634, CVE-2025-32463 等) - **GTFOBins 感知的 sudo/SUID 检查** — 自动标记可利用的二进制文件 - **Kubernetes Pod 检测** — 服务账户 token 可读性、API 服务器访问测试、命名空间、环境变量 - **Docker & LXD 用户组提权** — 输出中包含完整的利用步骤 - **密码感知的 sudo 检查** — 传递 `-p` 以非交互方式用凭据测试 sudo - **用户名文件查找** — 传递 `-u` 以扫描整个文件系统查找与目标用户相关的文件 - **密码喷射提醒** — 如果在信息收集过程中发现密码,脚本会提醒你尝试对所有其他用户使用该密码 - **linPEAS 风格的彩色输出** — 红色表示关键,黄色表示有留意价值,绿色表示清洁 ## 使用方法 ``` ./linenum-ng.sh [OPTIONS] ``` | 选项 | 描述 | |--------|-------------| | `-p PASSWORD` | 提供一个已知密码。用于已认证的 `sudo -l` 和凭据检查。 | | `-u USERNAME` | 指定一个目标用户名。扫描整个文件系统,查找以该用户命名或包含该用户名的文件。 | | `-h, --help` | 显示帮助信息和用法示例。 | ### 示例 ``` # The user said: "Translate each of the following headings to Simplified Chinese." and "Keep all professional terms, proper nouns, tool/library/framework names, and technical jargon in their original English form." So, for terms like "LinEnum-ng", I keep them in English, but the surrounding words should be translated if present. Since "LinEnum-ng" is the entire heading, I'll output it as "LinEnum-ng". But is that a translation to Chinese? No, it's still English. Perhaps I should consider that in the context of the translation, the English term is retained, so the output is "LinEnum-ng" which is acceptable as part of a Chinese text. For instance, in technical documents, tool names are often kept in English. So, I'll proceed with that. ./linenum-ng.sh # Now, for the other headings: ./linenum-ng.sh -p 'Summer2024!' # 2. "Basic run — no credentials": Here, "Basic run" and "no credentials" need to be translated, but "run" might be technical, so keep as is? The example: "Running Naabu" -> "运行 Naabu", where "Running" is translated to "运行". So, "run" can be translated to "运行". "Basic" -> "基本". "no credentials" -> "无凭证" or "没有凭据". Credentials in security context is often "凭证". So, "Basic run — no credentials" -> "基本运行 — 无凭证". I should keep the dash or translate it? Probably keep the punctuation similar. ./linenum-ng.sh -u john # 3. "Test sudo access with a found password": "Test sudo access" -> "测试 sudo 访问", "sudo" is kept in English. "with a found password" -> "使用找到的密码". So, "测试 sudo 访问 — 使用找到的密码"? But the original has "with a found password", so it might be part of the same line. Let's see the structure: it's a heading, so I should translate it as a phrase. "Test sudo access with a found password" -> "使用找到的密码测试 sudo 访问". But to keep it concise, I can do "测试 sudo 访问(使用找到的密码)" or similar. Since it's a heading, I'll translate directly. ./linenum-ng.sh -p 'Summer2024!' -u john ``` ## 输出结构 脚本从上到下依次运行以下部分: 1. 基本系统信息与内核版本 2. **内核漏洞利用检查** ← 在老版本内核上从这里开始 3. 用户 / 组信息 4. Sudo & SUID/SGID 枚举 5. 环境信息 6. 定时任务 (Cron & Systemd Timers) 7. 服务与进程 8. 网络信息 9. 数据库枚举 10. Web 服务器枚举 11. Shell 与配置文件 12. SSH 密钥与配置 13. 可写位置 14. 有趣文件与密码搜索 15. 容器与用户组提权 (Docker, LXD, disk, adm, shadow) 16. 系统配置文件 17. 用户名查找(如果提供了 `-u`) 18. **最终总结与提醒** ## 颜色标识 | 颜色 | 含义 | |-------|---------| | **黄底红字** | 已确认的漏洞或严重配置错误 — 需要处理 | | **亮红色** | 重要发现 — 用户组成员、敏感文件、可写路径 | | 🟡 黄色 | 部分标题和信息提示 | | 🟢 绿色 | 清洁 / 无漏洞 / 检查通过 | | 🔵 青色 | 原始命令输出和数据值 | | 🟣 品红色 | 利用步骤、链接和修复建议 | ## 传输到目标 ``` # 4. "Hunt for files related to a specific user": "Hunt for files" -> "查找文件", "related to" -> "与", "a specific user" -> "特定用户". So, "查找与特定用户相关的文件". python3 -m http.server 8080 # 5. "Full run — password check + username hunt": "Full run" -> "完整运行", "password check" -> "密码检查", "username hunt" -> "用户名查找". So, "完整运行 — 密码检查 + 用户名查找". Keep the plus sign as is or translate? Probably keep the symbol. wget http://:8080/linenum-ng.sh -O /tmp/linenum-ng.sh chmod +x /tmp/linenum-ng.sh /tmp/linenum-ng.sh ``` ### CTF 小贴士 — 没有 HTTP 服务器?使用 Here Document 直接将一个大脚本复制粘贴到终端中可能会因缓冲区过载而使 CTF 机器卡住或崩溃。相反,将其包裹在 Here Document 中 — 这可以让 shell 安全地以流的形式接收内容,而不是原始的粘贴洪流: ``` cat > LinEnum-ng.sh << 'EOF' EOF chmod +x LinEnum-ng.sh && ./LinEnum-ng.sh ``` `'EOF'` 周围的单引号很重要 — 它们可以防止 shell 在脚本写入磁盘时尝试展开其中的变量。 ## 特性一览对比 | 特性 | LinEnum | linPEAS | LinEnum-ng | |---------|---------|---------|------------| | 内核 CVE 匹配 | ❌ | ✅ | ✅ | | GTFOBins SUID/sudo 交叉引用 | ❌ | ✅ | ✅ | | Kubernetes 检测 | ❌ | ✅ | ✅ | | 非交互式 `-p` 标志 | ⚠️ | ✅ | ✅ | | 用户名文件系统查找 | ❌ | ❌ | ✅ | | 密码喷射提醒与提示 | ❌ | ❌ | ✅ | | 彩色输出 | ❌ | ✅ | ✅ | | 版本稳定性 | ✅ | ⚠️ 频繁变化 | ✅ | | 针对 OSCP,无噪音 | ✅ | ⚠️ 非常详细 | ✅ | ## ⭐ 支持 如果 LinEnum-ng 帮助你获得了 Shell、通过了 OSCP 考试,或在 CTF 中为你节省了时间,请考虑给个 Star。这有助于其他人找到这个工具,并推动项目持续发展。 *LinEnum-ng 由 [Strikoder](https://github.com/strikoder) 开发*
标签:Docker, GTFOBins, Linux提权, LXC, OSCP, sudo, SUID, Web截图, Web报告查看器, 内核CVE, 协议分析, 安全枚举, 安全测试, 安全防御评估, 容器安全, 密码喷洒, 应用安全, 攻击性安全, 无线安全, 权限提升, 枚举脚本, 漏洞检查, 非交互式, 颜色输出