Community程式設計與開發github.com

yaklang/linux-lateral-movement

Linux 橫向移動行動手冊。在獲得初始存取權限後,用於透過 SSH 劫持、憑證收集、內部橫向移動、D-Bus 利用、sudo 令牌重用和共享檔案系統濫用,在 Linux 主機之間進行跳板攻擊。

linux-lateral-movement 是什麼?

此技能提供一個專注於 Linux 環境的橫向移動行動手冊,專為在已取得初始存取權限(例如通過漏洞利用或社交工程)的紅隊或滲透測試場景中設計。其主要用途是讓安全專業人員能夠從已攻陷的主機跳板到網路內的其他 Linux 主機,從而擴大控制範圍。該技能支援多種技術,包括 SSH 劫持(利用現有連線)、憑證收集與重用(如從記憶體或設定檔提取)、透過被攻陷主機進行內部連接埠轉發與代理、利用 D-Bus 訊息匯流排進行權限提升或橫向移動、以及濫用共享檔案系統(如 NFS 或 Samba)來執行惡意程式碼。它支援在常用的攻擊框架(如 Metasploit 或 Cobalt Strike)以及手動腳本環境中使用。透過詳細的步驟和指令,它指導使用者如何在不同情境中選擇最有效的技術,並考慮目標系統的防禦機制。

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

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

linux-lateral-movement 是做什麼的?

Linux 橫向移動行動手冊。在獲得初始存取權限後,用於透過 SSH 劫持、憑證收集、內部橫向移動、D-Bus 利用、sudo 令牌重用和共享檔案系統濫用,在 Linux 主機之間進行跳板攻擊。

概述

此技能提供一個全面的行動手冊,用於在 Linux 環境中執行橫向移動。它涵蓋多種技術,以幫助安全專業人員在初始入侵後擴展其立足點。

技術

1. SSH 劫持

  • 利用現有 SSH 連線進行跳板。
  • 使用 ssh -A 啟用代理轉發。
  • 透過 SSH 控制主控來劫持會話。

2. 憑證收集

  • 從 ~/.ssh/ 目錄提取 SSH 金鑰。
  • 從 ~/.bash_history 或 ~/.bashrc 收集憑證。
  • 從 grep -r "password" /etc/ 等檔案中擷取密碼。

3. 內部橫向移動

  • 使用 ssh -L 或 ssh -R 進行本地或遠端連接埠轉發。
  • 設定 socat 或 netcat 作為代理。
  • 利用 sshuttle 建立 VPN 隧道。

4. D-Bus 利用

  • 使用 dbus-send 發送訊息。
  • 透過 D-Bus 服務進行命令注入。
  • 利用 org.freedesktop.DBus.Properties 與其他服務互動。

5. sudo 令牌重複使用

  • 在會話中快取 sudo 憑證。
  • 使用 sudo -k 使令牌失效,或使用 sudo -v 更新時間戳。
  • 濫用 sudo -l 列舉權限。

6. 共享檔案系統濫用

  • 利用 NFS 共享掛載。
  • 透過 Samba 共享進行跳板。
  • 使用 mount -t nfs 掛載遠端共享。

使用案例

  • 在滲透測試中,從一個被攻陷的 Web 伺服器橫向移動到資料庫伺服器。
  • 在紅隊演練中,透過 SSHF 隧道存取隔離的內部服務。
  • 利用 D-Bus 服務提升權限或實現橫向移動。

範例指令

# 使用 SSH 代理轉發進行跳板
ssh -A user@target_host

# 透過本地連接埠轉發存取內部服務
ssh -L 8080:internal_host:80 user@proxy_host

# 使用 sshuttle 建立 VPN 隧道
sshuttle -r user@proxy_host 10.0.0.0/24

注意事項

  • 請確保所有活動均符合授權範圍,並具有明確的書面許可。
  • 使用這些技術時,請注意目標系統的日誌記錄和監控。
  • 始終考慮因操作而可能導致的服務中斷。

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.

相關技能