【过年了,每天发一篇以前的存货,一共七篇。】
现代cms框架(laraval/symfony/slim)的出现,导致现今的php漏洞出现点、原理、利用方法,发生了一些变化,这个系列希望可以总结一下自己挖掘的此类cms漏洞。
今天这个漏洞是Edusoho的一个user表dump漏洞。
首先,我简要说明一下漏洞原理。
【漏洞源码下载: https://mega.nz/#!4chVWCAB!xBVyC9QqxMCmeuLu3rGx__PwgkLe_a5NWUITLS3QzuM 】
0x01 开启DEBUG模式造成的隐患
Edusoho开启调试模式以后将会在程序出错后输出debug信息,其中包括当前环境中所有变量的值。默认的index.php是不开启debug的,但/api/index.php将会开启debug:
跟进一下框架的异常处理方法。Index.php里注册了异常处理:
ErrorHandler::register();ExceptionHandler::register();
这里用的是Symfony框架自带的异常处理类:use Symfony\Component\Debug\ExceptionHandler; 跟进:
调用了set_exception_handler注册的异常处理方法。不断跟进,发现该类的getContent方法是输出错误内容的方法:
可见,这个异常类,将异常对象的”args”属性输出了。 认真学习过php异常处理类的同学应该知道,异常类的getTrace方法( http://php.net/manual/zh/exception.gettrace.php )是可以获取到当前上下文中所有变量的。 所以,这里这个debug模式,等于说可以将当前函数中定义的所有变量输出。那么试想,假设当前函数在出异常前,从数据库或文件中读取到了一些『敏感』信息,那么输出这个异常是不是就可以dump出这个『敏感变量』了呢?
明显这个猜想是可行的。
那么,我只需要在/api下找到一处出错的代码,并且当前函数中有敏感信息的地方,即可触发成一个『大漏洞』。 很幸运的是我找到了好几处。最简单的一处,/api/src/user.php:373
这个 $follwers 变量是一个未定义的变量呀,所以一定会触发错误。
正好,当前函数中有 $user 、 $follwings 两个变量, $user 变量是指定的用户, $follwings 是它关注的用户。
所以,在报错输出调试信息以后,将会完全打印出这两个变量的值。而这两个变量都是从数据库user表里取出的数据,其中包含用户的所有信息(邮箱、密码hash、交易密码hash、salt、session、IP地址、昵称、登录时间等)。
另外, $follwings 变量里也有这些信息,我只要批量关注所有人,这个漏洞就变成了一个dump数据库user表的漏洞。
0x02 利用方式一,直接获取任意用户user表信息。
访问 http://demo.edusoho.com/api/users/{用户id}/followings 即可,如 http://demo.edusoho.com/api/users/5/followings
0x02 利用方式二,利用社交属性批量获取信息
利用方式二,首先关注你想获取密码的人,比如我关注了这四个,分别是Id为1、2、3、4的用户,其中1、4是管理员:
我的id是15670,直接访问 http://demo.edusoho.com/api/users/15670/followings ,即可获取我关注的所有人的所有信息,包括密码等:
诸如此处的地方还有一个。
http://demo.edusoho.com/api/users/1/friendship?toIds[]=a 通过传入数组制造warning:
其他位置肯定不止,还可能泄露其他信息,我就不一一挖掘了,只为证明问题存在。 这个漏洞已经私下里报给官方了,所以demo站已经修复。但搜索“powered by edusoho” 还是能找到很多存在漏洞的站,在时间上这个漏洞还是属于一个0day。 比如这个站: http://mooc.sinepharm.com/api/users/1/followings

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download
The most popular open source editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Dreamweaver CS6
Visual web development tools
