Mysql数据库UDF的安全问题利用
最近一直在休假,没有写博客,转眼十一还剩最后一天,时间真的很快。今天想谈谈数据库的安全问题。对于数据库的安全问题,首先,重要的生成库千万不能放在公网上
最近一直在休假,没有写博客,转眼十一还剩最后一天,时间真的很快。今天想谈谈数据库的安全问题。
对于数据库的安全问题,,首先,重要的生成库千万不能放在公网上,一旦被黑客入侵后果不堪设想,轻则数据丢失,重则被脱裤(整库被打包导出),如果恰恰又以明文存储了用户的密码,那么就太可怕了,去年轰动一时的某几个大型网站的用户数据泄漏事件都是因为明文的方式存储了用户的密码。
其次是大量的数据库弱口令问题存在,造成这个问题的原因往往是sa或者dba对安全问题疏忽,只为方便。
今天无意扫到一个弱口令的mysql数据库,我的话题也从这个弱口令mysql库开始。首先远程登录数据库,居然还是mysql数据库里root用户的弱口令,毫不客气的进入了数据库,执行一条sql语句查看ip地址和/etc/passwd文件的内容
查看下这个udf库所支持的函数
创建函数并且查看是否创建成功,可以看到一个名叫sys_eval的UDF创建成功了。
最后利用UDF执行更高权限的功能
剩下的就用这个UDF获得系统权限吧,提示可以用nc反弹,在自己的主机上执行nc -vv -l -p 12345,在数据库上执行一下sql语句
就可以成功反弹出linux shell了,再往下就。不过UDF的利用也有局限性,需要有mysql库的操作权限,在mysql库下必须有func表;在skipgranttables开启的情况下,UDF会被禁止。
PS:mysqludf.so是我已有的一个库文件,利用它生成了udf.txt,执行以下sql语句即可
mysql> select hex(load_file('/usr/lib/mysqludf.so')) into outfile '/tmp/udf.txt'; Query OK, 1 row affected (0.04 sec)
本文出自 “老徐的私房菜” 博客,谢绝转载!

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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

How to create tables using SQL statements in SQL Server: Open SQL Server Management Studio and connect to the database server. Select the database to create the table. Enter the CREATE TABLE statement to specify the table name, column name, data type, and constraints. Click the Execute button to create the table.

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

This article introduces a detailed tutorial on joining three tables using SQL statements to guide readers step by step how to effectively correlate data in different tables. With examples and detailed syntax explanations, this article will help you master the joining techniques of tables in SQL, so that you can efficiently retrieve associated information from the database.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

phpMyAdmin can be used to create databases in PHP projects. The specific steps are as follows: Log in to phpMyAdmin and click the "New" button. Enter the name of the database you want to create, and note that it complies with the MySQL naming rules. Set character sets, such as UTF-8, to avoid garbled problems.

Methods to judge SQL injection include: detecting suspicious input, viewing original SQL statements, using detection tools, viewing database logs, and performing penetration testing. After the injection is detected, take measures to patch vulnerabilities, verify patches, monitor regularly, and improve developer awareness.

The methods to check SQL statements are: Syntax checking: Use the SQL editor or IDE. Logical check: Verify table name, column name, condition, and data type. Performance Check: Use EXPLAIN or ANALYZE to check indexes and optimize queries. Other checks: Check variables, permissions, and test queries.
