Home page logo
/

pen-test logo Penetration Testing mailing list archives

Re: Remote Console on MySQL
From: Marco Ivaldi <raptor () 0xdeadbeef info>
Date: Thu, 6 Apr 2006 15:59:16 +0200 (CEST)

Hey Frank,

On Wed, 5 Apr 2006, tester () secfocus com wrote:

Im doing a pentest and found 3306 open with no password.  I logged in a
root using Navcat MYSQL GUI..

[snip]

root () myipaddress does not have privilages to the main mysql database..
                                                                              
My question:
                                                                              
Can you run commands on mysql to interact with the OS like XP..cmdshell
in MSSQL?

First of all, which version of the database are you currently testing? If
it's an old release maybe you can exploit some known vulnerabilities:

http://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=mysql

AFAIK, although since MySQL 5 the stored procedure mechanism has been
finally implemented, MySQL doesn't ship with any default stored procedures
(yet).

Thus, if you don't have enough privileges to create a User Defined
Function (UDF) or a procedure (i haven't looked at them yet, so i'm not
sure you can execute OS commands through stored procedures) yourself, i
don't believe you'll be able to run commands interacting with the
underlying OS.

Anyway, to learn more about MySQL UDFs you should take a look at my
privilege escalation examples (YMMV):

http://www.0xdeadbeef.info/exploits/raptor_udf.c
http://www.0xdeadbeef.info/exploits/raptor_udf2.c

Moreover, i recommend you the following readings as well (google for more
similar resources):

http://www.ngssoftware.com/papers/HackproofingMySQL.pdf
http://dev.mysql.com/doc/refman/5.0/en/udf-security.html
http://www.wisec.it/vulns.php?page=4
http://www.wisec.it/vulns.php?page=5
http://www.wisec.it/vulns.php?page=6

Finally, here's an excellent resource about MySQL (and other DBMs)  
security:

http://www.databasesecurity.com/mysql.htm

Good luck with the pen-test,

-- 
Marco Ivaldi
Antifork Research, Inc.   http://0xdeadbeef.info/
3B05 C9C5 A2DE C3D7 4233  0394 EF85 2008 DBFD B707


------------------------------------------------------------------------------
This List Sponsored by: Cenzic

Concerned about Web Application Security? 
Why not go with the #1 solution - Cenzic, the only one to win the Analyst's 
Choice Award from eWeek. As attacks through web applications continue to rise, 
you need to proactively protect your applications from hackers. Cenzic has the 
most comprehensive solutions to meet your application security penetration 
testing and vulnerability management needs. You have an option to go with a 
managed service (Cenzic ClickToSecure) or an enterprise software 
(Cenzic Hailstorm). Download FREE whitepaper on how a managed service can 
help you: http://www.cenzic.com/news_events/wpappsec.php 
And, now for a limited time we can do a FREE audit for you to confirm your 
results from other product. Contact us at request () cenzic com for details.
------------------------------------------------------------------------------


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]