ThinPHP5

hacker4年前关于黑客接单698

规矩,大家立即上基础教程,很少bb,这里有了你要想学习培训的 *** 黑客基础教程,浓浓的干货知识赠给大伙儿,沒有空话,现在开始!

ThinPHP5.1 程序运行系统漏洞

0x1 系统漏洞剖析

补丁下载文档地理位置:/thinkphp/library/think/route/dispatch/Url.php 56-66行



        if ($this->param['auto_search']) {
            $controller = $this->autoFindController($module, $path);
        } else {
            // 分析控制板
            $controller = !empty($path) ? array_shift($path) : null;
        }

        if (!preg_match('/^[A-Za-z](\w|\.)*$/', $controller)) { patch fix vuls
            throw new HttpException(404, 'controller not exists:' . $controller);
        }

        // 分析实际操作

具体步骤文档:/thinkphp/library/think/route/dispatch/Module.php

<?php

        parent::init();

        $result = $this->dispatch;
        /*
        $result详细被恳求的url
        thinkphp一切正常适用 
        index.php/index/index/index
        index.php?s=index/index/index
        两种方式的路由器
        $result="index/index/index"
        */
        if (is_string($result)) {
            $result = explode('/', $result);
        }

        if ($this->rule->getConfig('app_multi_module')) {
            // 多控制模块布署
            $module    = strip_tags(strtolower($
result[0] ?: $this->rule->getConfig('default_module')));
            $bind      = $this->rule->getRouter()->getBind();
            $available = false;

            if ($bind && preg_match('/^[a-z]/is', $bind)) {
                // 关联控制模块
                list($bindModule) = explode('/', $bind);
                if (empty($result[0])) {
                    $module = $bindModule;
                }
                $available = true;
            } elseif (!in_array($module, $this->rule->getConfig('deny_module_list')) && is_dir($this->app->getAppPath() . $module)) {
                $available = true;
            } elseif ($this->rule->getConfig('empty_module')) {
                $module    = $this->rule->getConfig('empty_module');
                $available = true;
            }
            二十四小时接单子的 *** 黑客
            // 控制模块复位
            // echo $this->app->getAppPath() . $module."<br>";
            // var_dump(is_dir($this->app->getAppPath() . $module));

            //echo $module,$available;die();
            if ($module && $available) {
                // 复位控制模块
                //echo 123123;
                $this->request->setModule($module);
                $this->app->init($module);
            } else {
                throw new HttpException(404, 'module not exists:' . $module);
            }
        }

        // 是不是全自动变换控制板和实际操作名
        var_dump($result);
        $convert = is_bool($this->convert) ? $this->convert : $this->rule->getConfig('url_convert');
        // 获得控制板名
        $controller = strip_tags($result[1] ?: $this->rule->getConfig('default_controller')); //切分了/以后取第二个主要参数

        $this->controller = $convert ? strtolower($controller) : $controller;

        // 获得实际操作名
        $this->actionName = strip_tags($result[2] ?: $this->rule->getConfig('default_action')); //切分了/以后取第三个主要参数
        echo 'init:'.$this->controller."<br>";
        // 设定当今恳求的控制板、实际操作
        $this->request
            ->setController(Loader::parseName($this->c
ontroller, 1))
            ->setAction($this->actionName);

        return $this;
    }

    public function exec()
    {
        // 监视module_init
        $this->app['hook']->listen('module_init');

        try {
            // 实例化控制板
            echo 'exec:'.$this->controller."<br>";
            $instance = $this->app->controller($this->controller,
                $this->rule->getConfig('url_controller_layer'),
                $this->rule->getConfig('controller_suffix'),
                $this->rule->getConfig('empty_controller'));

         ...
            //echo 123;die();
            $data = $this->app->invokeReflectMethod($instance, $reflect, $vars);

...

在看 $this->app->controller函数原型 /thinkphp/library/think/App.php

  public function controller($name, $layer = 'controller', $appendSuffix = false, $empty = '')
    {   
        echo $name, $layer, $appendSuffix."<br>";
        list($module, $class) = $this->parseModuleAndClass($name, $layer, $appendSuffix); //重中之重启用了parseModuleAndClass
        var_dump(class_exists($class));
        echo 'class:'.$class."<br>";
        if (class_exists($class)) {
            echo 'class_exists<br>';
            return $this->__get($class);
        } elseif ($empty && class_exists($emptyClass = $this->parseClass($module, $layer, $empty, $appendSuffix))) {
            return $this->__get($emptyClass);
        }

        throw new ClassNotFoundException('class not exists:' . $class, $class);
    }

    protected function parseModuleAndClass($name, $layer, $appendSuffix)
    {   echo 'parseModuleAndClass:'.$name."<br>";
        if (false !== strpos($name, '\\')) { //假如name种包括\则取值给class
            $class  = $name;

            $module = $this->request->module();

        } else {
            if (strpos($name, '/')) {
                list($module, $name) = explode('/', $name, 2);
            } else {
                $module = $this->request->module();
            }

            $class = $this->parseClass($module, $layer, $name, $appendSuffix);
        }

        return [$module, $class];
    }

0x2 漏洞检测

见到这儿基础就能了解了 假如浏览

http://127.0.0.1:8023/index.php?s=index/think\Loader/esss&a=1asdasd

就可以启用think\Loader 这一namespace下边的esss涵数,以便便捷检测,我还在loader里加了一个esss涵数,截屏以下

下边要是寻找一个点能程序运行就可以 刚提前准备找点exploit就出来?大家是恶魔吗?

阅读推荐: *** 黑客大批量侵入网站教程

 

标签: 黑客技术

相关文章

PHP一句话木马全集

PHP一句话木马全集

因为PHP一句话木马可以说有很多,简易的、中等水平的、繁杂的.......,今日主要是共享一些较为强大的一些PHP一句话木马全集;   一、运用404错误页掩藏PHP小龙 <!DOC...

社会发展技术工程师工具箱

社会发展技术工程师工具箱

Social Engineer Toolkit 翻译中文可称:社会发展技术工程师工具箱;   什么是社会技术工程师工具箱? 由TrustedSec的创办人编写,社交媒体技术工程师工具箱(S...

aspcms后台拿shell的两种方法

aspcms后台拿shell的两种方法: 第一种:点击“界面风格”,然后选“编辑模板/CSS文件”,然后“添加模板”,文件名称写qxz.asp;.html, 在文件内容写一句话 <%e...

专用工具完全免费使用方法

专用工具完全免费使用方法

什么叫Inssider? Inssider是一种wifi网络扫描枪,致力于摆脱NetStumbler的别的专用工具的局限。Inssider能够 随時间追踪接收灵敏度,开启无线接入点并应用GPS纪录储...

网络服务器是啥系统软件?实际叫什么?及其是多少位几核

网络服务器是啥系统软件?实际叫什么?及其是多少位几核

1、提权的定义:将系统软件管理权限提高到root、 system 或是 administrator。   2、在网上提权的界定:取得网络服务器管理权限,而且取得成功登录网络服务器。 可是,...

妻子出走丈夫找“黑客”定位

昨天13:42,新浪网友@翠苑派出所 发微博:新晋奶爸报案,为了帮嗷嗷待哺的孩子找妈妈,他想尽办法,最后竟求助于网上的陌生人。陌生人称可以通过全球定位的网站找到妈妈,需要的只是妈妈的手机号和800...