URL 공격 의 실례 설명

URL 공격: 말 그대로 URL 을 이용 하여 공격 하 는 것 입 니 다. 공격 방식 은 주소 표시 줄 에 있 는 $ 를 변경 하 는 것 입 니 다.GET 의 매개 변 수 는 다음 URL 을 예 로 들 어 필요 한 추측 을 할 수 있 습 니 다.
http://www.myfreax.com/category.php?category=mysql3

공격 자 는 뒤의 매개 변수 인 my sql 3 의 수 치 를 변경 하여 추측 하거나 다른 수단 과 결합 할 수 있 습 니 다. 저 는 두 개의 Linux 발행 판 이 공격 도 구 를 전문 적 으로 하 는 것 과 테스트 하 는 것 이 매우 강하 고 모두 ubuntu 를 바탕 으로 제 작 된 것 을 알 고 있 습 니 다.
BackTrack  #        Linux    ,         
blackbox Linux  #         

다음은 실례 입 니 다.
<?php
    /**
     * 
     *  @author Freax
     *  @2014-3-24
     *  @contact  [email protected]
     * 
     */
    define('FREAX', true);
    require_once 'include/init.php';
    'http://www.myfreax.com/category.php?category=PHP5';//  url     
    class category{
        /**
         *            
         * @var Object
         */
        public $db;
        /**
         * smarty   
         * @var Object
         */
        public $smarty;
        /**
         *              
         * @var String
         */
        public $action;
        /**
         *    
         * @var Object
         */
        public $Page;
        /**
         *   id
         * @var string
         */
        public $cacheid;
        /**
         *    
         * @var String
         */
        public function __construct($db,$smarty,$page){  //               
            $this->db=$db;
            $this->smarty=$smarty;
            $this->Page=$page;
            $this->getAtion();
            $this->getData();
            $this->display();
        }
        /**
         *                               
         *        ,                     ,        
         */
        public function getAtion(){
            $bool=preg_match_all('/\d+/', $_SERVER['QUERY_STRING'],$match);
            /*          url     ,         ,       ,
             *                  ,              id,
             *       id    ,      sql   ,       */
            if (!$bool) {
                header("HTTP/1.1 301 Moved Permanently");   //             404,           ,         404    ,
                                                            //      ,              
                header("location:http://".WEB);
                exit();   //                 ,  php           \?\>
            }else {
                $this->action=$match[0][0];
            }
        }
        /**
         *     id
         * @return string
         */
        public function getcacheid(){
            $this->cacheid=(isset($_GET['category'])?$_GET['category']:'').@(isset($_GET['page'])?$_GET['page']:'');
            return $this->cacheid;
        }
        /**
         *             
         *       smarty     
         *           
         *      
         */
        public function getData(){
            /*     cacheid        ,                 ,  cacheid           ,
             * http://www.myfreax.com/category.php?category=PHP2&page=23   url      ,     ,     ,
             *            ,cacheid    ,     ,    ,      ,   N     
             *             $_GET       ,     ,  $article=$this->db->selectArrs。。。。。。。。。。。。      ,                     */
            if (!$this->smarty->isCached('index.html',$this->getcacheid())){
                $nav=$this->db->selectArrs('select * from '.PREFIX.'class');
                $this->Page->getTotalPageClass($this->db,PREFIX.'article','typeid',$this->action);
                $this->Page->getcurrPage();
                $this->Page->getStartPage();
                $article=$this->db->selectArrs('select  '.PREFIX.'article.*,'.PREFIX.'class.name from '.PREFIX.'article left join blog_class  on ('.PREFIX.'article.typeid='.PREFIX.'class.id)   where typeid= '.$this->action.' order by  id desc  limit '.$this->Page->startPage .','. $this->Page->paging);
                /*           
                 *  */
                if (!$article) {
                    header("HTTP/1.1 301 Moved Permanently");
                    header("location:http://".WEB);
                    exit();
                }
                $this->Page->getLinkPage('category.php');
                $this->Page->getClassPage($article[0]['name'].$article[0]['typeid']);
                $pagelink=$this->Page->createPageLinks();
                $navAtcion=@$article[0]['name'];
                $this->smarty->assign('articles',$article);
                $this->smarty->assign('navs',$nav);
                $this->smarty->assign('navAction',$navAtcion);
                $this->smarty->assign('pagelink',$pagelink);
                }
            }
        /**
         *                 
         *          
         */
        public function display(){
            $this->smarty->display('index.html',$this->getcacheid());
        }
    }
    /**
     *    category 
     */
    new category($db,$smarty,$page);
?>

좋은 웹페이지 즐겨찾기