Community编程与开发github.com

yaklang/linux-security-bypass

Linux 安全机制绕过手册。适用于在后期利用阶段需要绕过受限 bash/rbash、只读或无执行权限文件系统、AppArmor、SELinux、seccomp 过滤器或审计日志记录的场景。

linux-security-bypass 是什么?

这是一个专注于 Linux 安全机制绕过的专业技能手册,专为渗透测试后期利用阶段设计。当面对受限 shell(如 rbash)、只读或 noexec 文件系统、强制访问控制(如 AppArmor、SELinux)、系统调用过滤(seccomp)或审计日志记录时,该技能提供了一系列经过验证的绕过技术与操作步骤。它基于 `yaklang` 工具栈,适用于各类需要突破 Linux 系统安全限制的红队操作或安全研究人员。技能内容涵盖枚举受限环境、利用脚本语言执行、绕过文件系统限制、禁用或逃避审计日志等多个方面,帮助用户在严格限制的条件下保持操作能力。核心优势在于将零散的绕过技术系统化、场景化,提升在复杂安全防御下的任务成功率。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/yaklang/hack-skills/tree/main/skills/linux-security-bypass

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

linux-security-bypass 是做什么的?

Linux 安全机制绕过手册。适用于在后期利用阶段需要绕过受限 bash/rbash、只读或无执行权限文件系统、AppArmor、SELinux、seccomp 过滤器或审计日志记录的场景。

概述

当攻击或测试活动进入 Linux 系统的后期利用阶段时,常会遇到多种安全机制的限制,如受限 shell、文件系统权限控制、强制访问控制(MAC)系统以及系统调用过滤等。本手册系统地收集并整理了绕过这些限制的实用技术,帮助操作者即使在高度受限的环境中也能维持执行权限并继续推进任务。

支持的平台

  • Linux 发行版:广泛支持基于 Linux 内核的系统,包括 Ubuntu、Debian、CentOS、RHEL、Arch Linux 等。
  • 安全机制:针对 rbash、noexec 文件系统、AppArmor、SELinux、seccomp 及 audit 日志。
  • 工具栈:与 yaklang 生态集成,可在 yak 脚本中直接调用本手册的技巧。

使用场景

  1. 远程 Shell 访问受限(如 rbash)
  2. 文件系统挂载为只读或禁止执行程序
  3. 系统启用了 AppArmor 或 SELinux 的强制模式
  4. 系统调用被 seccomp 策略限制
  5. 审计日志需要被绕过以避免被追踪

常用绕过技术

受限 Shell 绕过

  • 利用子 shell:bash -c 'command' 或 sh -c 'command'
  • 利用环境变量:PATH=/usr/local/bin:$PATH 或使用 $SHELL
  • 通过 vi/less 逃逸:在 vi 中执行 :!bash 获得完整 shell
  • 利用 Python 或 Perl:在受限 shell 中执行任意命令

noexec 文件系统绕过

  • 使用解释器参数:/lib/ld-linux.so.2 /path/to/binary
  • 直接使用脚本解释器:python -c 'import os; os.execve("/bin/bash", [], {})'
  • 利用 /dev/shm 或 /tmp:如果这些目录有执行权限,则复制文件执行

AppArmor 绕过

SELinux 绕过

  • 检查上下文:id -Z 查看当前安全上下文
  • 使用 setenforce 0 如果允许,临时禁用 SELinux
  • 利用 unconfined 域:寻找 /usr/sbin/getenforce 或其他允许的二进制

seccomp 绕过

  • 使用更低级别的 syscall:如通过 ioctl 或 sched_setattr 实现某些功能
  • 利用内核漏洞:寻找已知的 seccomp 绕过 CVE
  • 检查 strace 输出:分析哪些系统调用被允许

审计日志绕过

  • 停止 auditd 服务:systemctl stop auditd 或 service auditd stop
  • 加载自定义审计规则:auditctl -a always,exit -S all -F key=bypass 来覆盖原始规则需要 root 权限
  • 临时禁用审计:echo 0 > /proc/sys/kernel/audit_enabled

注意事项

  • 某些绕过方法需要 root 权限或特定用户上下文。
  • 操作前请确保已评估目标环境的安全策略,避免误操作导致系统崩溃。
  • 本手册仅用于授权测试或安全研究,禁止用于非法目的。

参考链接

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

yaklang/401-403-bypass-techniques

401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.

yaklang/active-directory-acl-abuse

Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.

yaklang/active-directory-certificate-services

AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.

yaklang/active-directory-kerberos-attacks

Kerberos attack playbook for Active Directory. Use when targeting AD authentication via AS-REP roasting, Kerberoasting, golden/silver/diamond tickets, delegation abuse, or pass-the-ticket attacks.

yaklang/ai-ml-security

AI/ML security playbook. Use when assessing model supply chain attacks (pickle RCE, poisoned weights), adversarial examples, model poisoning, model stealing, data privacy attacks (membership inference, model inversion), and autonomous agent security risks.

yaklang/android-pentesting-tricks

Android pentesting playbook. Use when testing Android applications for SSL pinning bypass, exported component abuse, WebView vulnerabilities, intent redirection, root detection bypass, tapjacking, and backup extraction during authorized mobile security assessments.

yaklang/anti-debugging-techniques

Anti-debugging detection and bypass playbook. Use when reversing protected binaries that detect debuggers via ptrace, PEB flags, timing checks, or signal/exception handlers on Linux and Windows.

yaklang/api-auth-and-jwt-abuse

API authentication and JWT abuse playbook. Use when testing bearer tokens, API keys, claim trust, header spoofing, rate limits, and API auth boundary weaknesses.

yaklang/api-authorization-and-bola

API authorization and BOLA testing playbook. Use when APIs expose object identifiers, nested resources, hidden writable fields, or weak function-level authorization.

yaklang/api-recon-and-docs

API reconnaissance and documentation review playbook. Use when discovering endpoints, schemas, versions, OpenAPI specs, hidden docs, and surface area for API testing.

yaklang/api-sec

Entry P1 category router for API security. Use when choosing between API recon, authorization, token abuse, and hidden-parameter workflows before any deeper API topic skill.

yaklang/arbitrary-write-to-rce

Arbitrary write to RCE playbook. Use when you have an arbitrary write primitive (from heap exploitation, format string, or OOB write) and need to convert it into code execution by targeting GOT, hooks, _IO_FILE vtable, exit_funcs, TLS_dtor_list, modprobe_path, .fini_array, or C++ vtables.

yaklang/authbypass-authentication-flaws

Authentication bypass testing playbook. Use when assessing login flows, password reset logic, account recovery, MFA bypass, token predictability, brute-force resistance, and session boundary flaws.

yaklang/auth-sec

Entry P1 category router for authentication and authorization. Use when testing login flows, sessions, object authorization, JWT, OAuth, CORS, CSRF, and enterprise SSO weaknesses before any deeper auth topic skill.

yaklang/binary-protection-bypass

Binary protection bypass playbook. Use when identifying and bypassing ASLR, PIE, NX/DEP, stack canary, RELRO, FORTIFY_SOURCE, CET, and MTE protections in ELF binaries to enable exploitation.

yaklang/browser-exploitation-v8

Browser and V8 exploitation playbook. Use when exploiting JavaScript engine vulnerabilities including JIT type confusion, incorrect bounds elimination, and V8 sandbox bypass to achieve renderer RCE and sandbox escape in Chrome/Chromium.

yaklang/business-logic-vuln

Entry P1 category router for business logic testing. Use when workflow abuse, race conditions, pricing flaws, or multi-step state attacks matter more than parser-level input injection.

yaklang/business-logic-vulnerabilities

Business logic vulnerability playbook. Use when reasoning about workflows, race conditions, price manipulation, coupon abuse, state machines, and multi-step authorization gaps.

yaklang/classical-cipher-analysis

Classical cipher analysis playbook. Use when encountering substitution ciphers, Vigenere, transposition, XOR, or encoded text in CTF challenges that requires frequency analysis, Kasiski examination, or known-plaintext cryptanalysis.

yaklang/clickjacking

Clickjacking playbook. Use when testing whether target pages can be framed, whether X-Frame-Options or CSP frame-ancestors are properly configured, and whether UI redress attacks can trigger sensitive actions.

相关技能