去上交打国赛的时候web里面的后门
在15到16行间插入一个echo $L; 运行得到
整理一下
一直觉得自己sql注入还不错 直到遇到雨牛这个题 Orz
我是雨牛的脑残粉 :)
按照惯例 先上代码 如果看到奇怪的echo,只是我的调试代码~
read.php~
<?php
$file=isset($_GET['file'])?$_GET['file']:'';
if(empty($file)){
exit('The file parameter is empty,Please input it');
}
if( preg_match('/.php/i',$file) && is_file($file) ){
die("The parameter is not allow contain php!"); //
}
if( preg_match('/admin_index|\.\/|admin_xx_modify/i',$file) ){
die('Error String!');
}
$realfile = 'aaaaaa/../'.$file; //prevent to use agreement
if(!@readfile($realfile)){
exit('File not exists');
}
?>
看到第一个if 是&&一个is_file 那么只要后面为假就可以了
很难找到一个密码学的实例,就拿上一期的xor挑战来讲咯
和基友@overlord一起搞了俩天才弄出来,星期四下午刚学的知识,当天晚上就用上了,也是很神奇~
先上代码吧
<?php
include("config.php");
header("Content-type: text/html; charset=utf-8");
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
$ckey_length = 8;
$key = md5($key ? $key : '');
$keya = md5(substr($key, 0, 16));
$keyb = md5(substr($key, 16, 16));
$keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
$cryptkey = hash('sha256', $keya.md5($keya.$keyc));
$string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).md5($keyb.$string).$string;
$string_length = strlen($string);
$result = '';
for ($i=0; $i<$string_length; $i++){
$result .= $string[$i] ^ $cryptkey[$i % 64];
}
if($operation == 'DECODE') {
if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 32) == md5($keyb.substr($result, 42))) {
return substr($result, 42);
} else {
return '';
}
} else {
return $keyc.str_replace('=', '', base64_encode($result));
}
}
if (isset($_GET['showSource'])){
show_source(__FILE__);
die;
}
session_start();
if ($_COOKIE['auth']){
list($user, $password) = explode("\t", authcode($_COOKIE['auth'], 'DECODE', $secret_key));
if ($user !='' && $password != ''){
$sql = "select uid, username, password from users where username='$user'";
$result = mysql_query($sql);
if ($result){
$row = @mysql_fetch_array($result);
if ($row['password']===md5($password)){
$_SESSION['uid'] = $row['uid'];
echo "<div style=\"text-align:left\"><h4>Welcome ".$row['username'].". My lord!</h4></div><br/>";
}
}
}
}
if (!$_SESSION['uid']) {
echo "<div style=\"text-align:left\"><h4>Decrypt me!: ".authcode(base64_encode($msg), 'ENCODE', $secret_key)."</h4></div><br/>";
}else{
echo $msg;
}
?>
<!--<a href="/?showSource">view source</a>-->
更新有点迟了 CI框架看的有点晕(其实是玩了几天游戏,哈哈哈)
startbbs v1.2.3
如果有不对的地方请大牛指正
先说说框架,第一次看框架,完全懵逼状态。
主要要弄懂怎么路由
列如 http://192.168.131.136/startbbs/index.php/topic/show/1
会找到应用目录(app)控制器目录(controllers)下的topic.php的show方法参数为1
如图