0ctf 2019 zero_task
一个条件竞争的洞,以前没有接触过。比赛完研究了wp复现下。
new_thread结构体如下
new_thread:
thread_area size0x8
thread_area+0x8 size 0x8
thread_area+0x10 choice
thread_area+0x14 key 0x20
thread_area+0x34 IV 0x10
...
thread_area+0x60 task_id
thread_area+0x68 thread_binlist
thread_area+0x88 EVP_CIPHER_CTX_new
delete中并没有uaf的问题
void delete(void)
{
void **__ptr;
int task_id;
void **local_18;
void **local_10;
__ptr = DAT_00302028;
local_18 = DAT_00302028;
local_10 = DAT_00302028;
printf("Task id : ");
task_id = my_read8();
if ((DAT_00302028 == (void **)0x0) || (task_id != *(int *)(DAT_00302028 + 0xc))) {
while (local_18 != (void **)0x0) {
if (task_id == *(int *)(local_18 + 0xc)) {
local_10[0xd] = local_18[0xd];
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)local_18[0xb]);
free(*local_18);
free(local_18);
return;
}
local_10 = local_18;
local_18 = (void **)local_18[0xd];
}
}
else {
DAT_00302028 = (void **)DAT_00302028[0xd];
EVP_CIPHER_CTX_free((EVP_CIPHER_CTX *)__ptr[0xb]);
free(*__ptr);
/* 这里不存在uaf
00302028会存储线程链的值,在释放前会判断这个值是否为空
*/
free(__ptr);
}
return;
}
存在的问题是创建新线程执行start_routine时的条件竞争(这里产生条件竞争的原因是子线程会共享主线程的bss段,在创建子线程时sleep(2)后再更新bss段的数据)
void start_routine(uchar **ppuParm1)
{
int iVar1;
long in_FS_OFFSET;
int local_34;
uchar **local_30;
ulong local_28;
undefined8 local_20;
undefined8 local_18;
undefined8 local_10;
local_10 = *(undefined8 *)(in_FS_OFFSET + 0x28);
local_34 = ;
local_20 = ;
local_18 = ;
local_28 = ;
local_30 = ppuParm1;
puts("Prepare...");
sleep();
memset(DAT_00302030,,0x1010);
iVar1 = EVP_CipherUpdate((EVP_CIPHER_CTX *)local_30[0xb],DAT_00302030,&local_34,*local_30,
(int)local_30[]);
if (iVar1 == ) {
/* WARNING: Subroutine does not return */
pthread_exit((void *)0x0);
}
local_28 = local_28 + (long)local_34;
iVar1 = EVP_CipherFinal_ex((EVP_CIPHER_CTX *)local_30[0xb],DAT_00302030 + local_28,&local_34);
if (iVar1 == ) {
/* WARNING: Subroutine does not return */
pthread_exit((void *)0x0);
}
local_28 = local_28 + (long)local_34;
puts("Ciphertext: ");
my_printf(stdout,(long)DAT_00302030,local_28,0x10,);
/* WARNING: Subroutine does not return */
pthread_exit((void *)0x0);
}
神仙东西,思路大致看懂了tql,orz
总结一下学到的改变执行流的思路吧:条件竞争并不能写任意内存,程序也没有任意地址写的漏洞,这时可以尝试找一个相对地址的调用,如果这个相对地址可控,我们就可以改变执行流了
0ctf 2019 zero_task的更多相关文章
- 2019年台积电进军AR芯片,将用于下一代iPhone
近日,有报道表示台积电10nm 芯片可怜的收益率可能会对 2017 年多款高端移动设备的推出产生较大的影响,其中自然包括下一代 iPhone 和 iPad 机型.不过,台积电正式驳斥了这一说法,表明1 ...
- 0ctf – mobile – boomshakalaka writeup
作为一个web狗,一道web都没做出来Orz...做出来一道apk,纪念一下在ctf中做出的第一道apk... 首先在模拟器或者真机中安装一下apk看到是一个cocos2dx的打飞机游戏 根据题目提示 ...
- Observe the 0CTF & 0CON
I went to observe 0CTF and 0CON on 4.22 ~ 4.24 and just come back. Not only do I learn a lot from th ...
- VS经常报错的link error 2019
VS经常报错的link error 2019 原因如下: 可能是找得到头文件,但是相关的dll或者lib找不到,需要在配置里面添加相应的库文件. project=>configuration.. ...
- YTU 2019: 鞍点计算
2019: 鞍点计算 时间限制: 1 Sec 内存限制: 64 MB 提交: 66 解决: 30 题目描述 找出具有m行n列二维数组Array的"鞍点",即该位置上的元素在该行 ...
- Windows Server 2019 预览版介绍
在Windows server 2012.Windows server 2016还未完全普及的情况下,昨天Windows Server团队宣布Windows Server 2019将在2018年的下半 ...
- Telerik控件集-2019.R1.SP1.All
Telerik 专注于微软.Net平台的表示层与内容管理控件,提供高度稳定性和丰富性能的组件产品DevCraft,并可应用在非常严格的环境中.Telerik拥有 Microsoft, HP, Alco ...
- CTF丨2019互联网安全城市巡回赛·西安站,我们来了!
万物互联时代,网信事业发展突飞猛进,互联网悄然渗透到国民生活的每一个角落,伴随而来的网络安全威胁和风险也日渐突出.网络诈骗.钓鱼软件.勒索病毒等安全问题层出不穷,信息泄露等网络安全事件也频繁上演,给用 ...
- AI2(App Inventor 2)离线版服务器(2019.04.28更新)
我们的目标:搭建一个本地多用户的App Inventor 2 服务器 演示: http://ai2.fsyz.net [旧 win] http://ai2n.fsyz.net [新 Ce ...
随机推荐
- Photoshop调出田园照片唯美手绘油画效果
先看看效果图 原片分析:妹子脸上的光不够通透,有些灰暗,整体色调不够分明. 后期思路:色彩往油画风格调整,让画面色彩更加油润.丰富. 基础调整 (1)曝光根据照片的实际情况进行调整 (2)增加阴影部分 ...
- keras04 - 阿狗阿猫识别 面向对象编程
参考:https://www.bilibili.com/video/av32756783
- 第一章 初识 MyBatis
概念:优秀持久层框架:实体类和SQL语句之间建立映射关系 与hibernate区别 :自动生成sql语句,并且建立实体类和数据表的映射. MyBatis基本要素:核心对象 核心配置文件 S ...
- 设置tomcat开机自启和后台运行
前言:程序登录遇到了问题,重启服务器上的tomcat后程序可以正常的使用,是通过进入bin目录,双击startup.bat运行启动的程序,此时会弹出启动窗口,而且该窗口不能关闭,这个窗口是tomcat ...
- 将root 当成arraylist放入数据sturts2 入门笔记
刚启动idea 就报出错误 [-- ::,] Artifact -sturts2:war exploded: Error during artifact deployment. See server ...
- Pyhon进阶9---类的继承
类的继承 基本概念 定义 格式如下 继承中的访问控制 class Animal: __CNOUT = 0 HEIGHT = 0 def __init__(self,age,weight,height) ...
- tensorflow-TFRecord报错ValueError: Protocol message Feature has no "feature" field.
编写代码用TFRecord数据结构存储数据集信息是报错:ValueError: Protocol message Feature has no "feature" field.或和 ...
- luogu P1723 高手过愚人节
打算下周讲课就讲Manacher了 所以百度了一下相关题目,发现了一道千古好题 这道题没想到是一道模板题,模板中的模板 简要说一下思路,我们先复制一遍模板(甚至变量都不用改 然后唯一的区别就是要求的是 ...
- subprocess
在没有subprocess这个模块的时候,我们怎么去跟我们的操作系统做交互的呐?下面我们先说说这三个模块:os.system().os.popen().commands. 1. os.system( ...
- python学习日记(OOP数据封装)
class Student(object): def __init__(self,name,score): self.name = name self.score = score li = Stude ...