signed __int64 __fastcall baby_ioctl(__int64 a1, __int64 a2) { __int64 v2; // rdx signed __int64 result; // rax int i; // [rsp-5Ch] [rbp-5Ch] __int64 v5; // [rsp-58h] [rbp-58h]
_fentry__(a1, a2); v5 = v2; if ( a2 == 0x6666 ) { printk("Your flag is at %px! But I don't think you know it's content\n", flag); result = 0LL; } else if ( a2 == 0x1337 && !_chk_range_not_ok(v2, 0x10LL, *(__readgsqword(¤t_task) + 0x1358))// a3 >= a1+a2 && !_chk_range_not_ok(*v5, *(v5 + 8), *(__readgsqword(¤t_task) + 0x1358)) && *(v5 + 8) == strlen(flag) ) { for ( i = 0; i < strlen(flag); ++i ) { if ( *(*v5 + i) != flag[i] ) return 22LL; } printk("Looks like the flag is not a secret anymore. So here is it %s\n", flag); result = 0LL; } else { result = 14LL; } return result; }
程序通过ioctl来做交互
1 2
int fd = open("/dev/baby",0); int ret = ioctl(fd,0x6666);