Pattern Generator / Offset Finder

Pattern Generator / Offset Finder 버퍼 오버플로우 익스플로잇 개발 시 EIP/RIP 오프셋을 찾는 데 쓰는 cyclic pattern 생성기와 오프셋 조회기. Metasploit의 msf-pattern_create / msf-pattern_offset과 동일한 알고리즘(Aa0Aa1Aa2...Zz9 — 26×26×10×3 = 20,280 bytes까지 unique)으로 동작하며, 모든 계산은 브라우저에서 로컬로 실행됩니다 (서버 전송 없음). 사용 흐름: 패턴 생성 → 타겟 바이너리에 입력 → 크래시 시 EIP/RIP 값 확인 → 그 값을 오프셋 조회기에 붙여넣기 → 반환 주소 위치 확정. 1. 인터랙티브 (브라우저 실행) Pattern Create Length (bytes, max 20280) Generate Copy Pattern Offset EIP/RIP 값 또는 ASCII 조각 Pattern length used Find Offset 2. Metasploit CLI # 패턴 생성 (길이 지정) msf-pattern_create -l 400 # EIP 값으로 오프셋 조회 (리틀엔디안 자동 처리) msf-pattern_offset -l 400 -q 0x37694136 # Kali에 msf-pattern_* 없으면 전체 경로 /usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l 400 /usr/share/metasploit-framework/tools/exploit/pattern_offset.rb -l 400 -q 0x37694136 3. pwntools (Python) # CLI cyclic 400 # 400바이트 패턴 (알파벳 전용, de Bruijn) cyclic -l 0x61616166 # 값으로 오프셋 조회 cyclic -l aaaf # ASCII 조각으로 조회 cyclic -n 8 400 # x64용 8바이트 단위 패턴 # 스크립트에서 직접 from pwn import cyclic, cyclic_find payload = cyclic(400) # bytes offset = cyclic_find(0x61616166) # int offset8 = cyclic_find(b'aaaaaaaf', n=8) # x64 참고 — Metasploit vs pwntools: 두 패턴은 알고리즘이 다릅니다 (MSF는 Aa0Aa1Aa2…, pwntools cyclic은 알파벳 전용 de Bruijn). 생성에 쓴 쪽과 조회에 쓰는 쪽을 같은 도구로 통일하세요. 섞으면 오프셋이 안 나옵니다. ...

10월 18, 2026 · 4 분