-
-
[分享]2022KCTF秋季赛第六题,初学者从0跟着学习,感谢各位大神
-
发表于: 2022-12-8 12:06 11670
-
借鉴了两篇文章,非常感谢,学习win逆向
https://bbs.pediy.com/thread-275344.htm
https://bbs.pediy.com/thread-275326.htm
通过搜索字符串定位到关键函数,然后静态分析内部:













现在只需要找出目标1:&unk_40F000 和目标2:&unk_40F050 即可利用爆破解出随机因子了,即前五字节和后五字节(中间四字节为KCTF)
步骤参考:IDA动态调试exe文件


感谢各位大佬的逆向文档,这题虽然很简单,对于初入逆向的很有帮助,不断学习。也恳求大佬写文章时能浅显一点,照顾一下我们初学菜鸟(非常感谢大佬们)
#include <stdio.h>#include <stdlib.h>#include <string.h>// 全局变量
static unsigned int _getptd_20 = 0;
// 自定义srand函数,传入随机因子
void self_srand(unsigned int Seed)
{ _getptd_20 = Seed;
}// 自定义随即函数
int self_rand()
{ unsigned int v1; // eax
v1 = 214013 * _getptd_20 + 2531011;
_getptd_20 = v1;
return (v1 >> 16) & 0x7FFF; //HIWORD(v1) & 0x7FFF;
}int baopo(const int *arr){
int seed = 0;
while(1){
// 次数每个新种子时要清零
int succ_time =0;
// 设置随机因子
self_srand(seed);
// 比较所有的数组是否一样:self_rand()种子一样 + 调用次数一样=====》self_rand()结果一致
int temp;
for(int i = 0;i < 20;i++){
if((temp =self_rand()) != arr[i]){
break;
}else{
succ_time++;
}
}
// 说明self_rand,连续20次生成的值都与目标一致,说明结果找到了;此步骤防止最后一次成功,其他值却不成功的现象!
if(succ_time == 20){
break;
}else{
seed++;
}
}
return seed;
}int main(int argc, char const *argv[])
{ int arr1[] = {0x3BFC,0x2173,0x25BB,0x380B,0x2C13,0x75BE,0x7366,0x46A3,0x13C1,0x159B,0x5B5F,0x534F,0x4E37,0x3A04,0x1301,0x5D0C,0x4155,0x48E9,0x61D2,0x6158};
int arr2[] = {0x2BB6,0x6B5A,0x03D4,0x152B,0x6E04,0x254C,0x40AE,0x56CA,0x17E1,0x55C7,0x3641,0x2D3C,0x0A41,0x4BC5,0x6233,0x1FE7,0x6E05,0x0F6E,0x6398,0x6AD7};
int a = baopo(arr1);
int b = baopo(arr2);
char str1[256];
char str2[256];
sprintf(str1,"%d",a);//将整数a写入到字符串中
sprintf(str2,"%d",b);//将整数b写入到字符串中
printf("前五个的字符串为:%s\n",str1);
printf("后五个的字符串为:%s\n",str2);
printf("最终结果为:%dKCTF%d\n", a, b);
// printf("%d\n", a);
return 0;
}#include <stdio.h>#include <stdlib.h>#include <string.h>// 全局变量
static unsigned int _getptd_20 = 0;
// 自定义srand函数,传入随机因子
void self_srand(unsigned int Seed)
{ _getptd_20 = Seed;
}// 自定义随即函数
int self_rand()
{ unsigned int v1; // eax
v1 = 214013 * _getptd_20 + 2531011;
_getptd_20 = v1;
return (v1 >> 16) & 0x7FFF; //HIWORD(v1) & 0x7FFF;
}int baopo(const int *arr){
int seed = 0;
while(1){
// 次数每个新种子时要清零
int succ_time =0;
// 设置随机因子
self_srand(seed);
[培训]传播安全知识、拓宽行业人脉——看雪讲师团队等你加入!
最后于 2022-12-30 20:09
被kanxue编辑
,原因:
赞赏记录
参与人
雪币
留言
时间
心游尘世外
感谢你的贡献,论坛因你而更加精彩!
2025-6-28 04:55
wx_孤城
为你点赞~
2023-8-10 16:06
伟叔叔
为你点赞~
2023-3-18 00:16
PLEBFE
为你点赞~
2023-1-10 13:45
赞赏
他的文章
赞赏
雪币:
留言: