0x00 知识点

种子爆破

工具

http://www.openwall.com/php_mt_seed

0x01 解题

查看源码进入check.php

zOHF0Cxp49
<?php
#这不是抽奖程序的源代码!不许看!
header("Content-Type: text/html;charset=utf-8");
session_start();
if(!isset($_SESSION['seed'])){
$_SESSION['seed']=rand(0,999999999);
} mt_srand($_SESSION['seed']);
$str_long1 = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$str='';
$len1=20;
for ( $i = 0; $i < $len1; $i++ ){
$str.=substr($str_long1, mt_rand(0, strlen($str_long1) - 1), 1);
}
$str_show = substr($str, 0, 10);
echo "<p id='p1'>".$str_show."</p>"; if(isset($_POST['num'])){
if($_POST['num']===$str){x
echo "<p id=flag>抽奖,就是那么枯燥且无味,给你flag{xxxxxxxxx}</p>";
}
else{
echo "<p id=flag>没抽中哦,再试试吧</p>";
}
}
show_source("check.php");

发现mt_scrand(),mt_rand()这俩函数; 并且session是用的随机数设置的;

先用脚本将伪随机数转换成php_mt_seed可以识别的数据

str1='abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
str2='zOHF0Cxp49'
str3 = str1[::-1]
length = len(str2)
res=''
for i in range(len(str2)):
for j in range(len(str1)):
if str2[i] == str1[j]:
res+=str(j)+' '+str(j)+' '+'0'+' '+str(len(str1)-1)+' '
break
print res

得到

将这一串拿到工具里去使用

爆破出伪随机数和php版本

./php_mt_seed 25 25 0 61 50 50 0 61 43 43 0 61 41 41 0 61 26 26 0 61 38 38 0 61 23 23 0 61 15 15 0 61 30 30 0 61 35 35 0 61

将send设置为:819101489,如下

改写源码,生成完整字符串(如爆破到的seed是830701381)

<?php
mt_srand(819101489); $str_long1 = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$str='';
$len1=20;
for ( $i = 0; $i < $len1; $i++ ){
$str.=substr($str_long1, mt_rand(0, strlen($str_long1) - 1), 1);
}
echo $str; ?>

拿着得到得字符转提交

最新文章

  1. 学习CodeIgniter框架之旅(二)继承自定义类
  2. java面向对象(封装-继承-多态)
  3. 换iphone5屏幕你花了多少钱?不防我们看下市场的批发价格
  4. Python数据结构——散列表
  5. 创建一个基本的Windows应用程序
  6. Python第一天——入门Python(2)字符串的简单操作
  7. wxWidgets显示视频
  8. Codeforces 1097E. Egor and an RPG game 构造
  9. Oracle数据库自带表或者视图
  10. Python爬虫的步骤和工具
  11. 移动端滑屏全应用【一】cssHandler操作基础动画函数封装
  12. JavaScript -基础- 函数与对象(四) BOM 对象
  13. Oracle中的自连接(self join)-当表中的某一个字段与这个表中另外字段的相关时,我们可能用到自连接。
  14. UVA10954:Add All(优先队列)
  15. ios系统架构及常用框架
  16. Python(内置函数)
  17. 从零开始的全栈工程师——html篇1
  18. 分布式压测系列之Jmeter4.0第一季
  19. ROS创建工作空间
  20. tar 多文件解压压缩

热门文章

  1. Ternsorflow 学习:003-MNIST入门有关概念
  2. 使用six库将Python2的项目完全转移到python3
  3. HomePod即将发售,但硬件不再是苹果的救命稻草
  4. php的排序算法
  5. 034、Java中自增之++在前面的写法
  6. putty Linux 自动补全
  7. mysql limit查询入门
  8. html5移动端主流适配方案
  9. 安卓fragment transaction add方法报错
  10. JuJu团队11月27号工作汇报