Challenge 2


aivilo
Member
Registered: 08.11.13 01:51
Timezone: UTC +0
Posts: 3

Can someone give me a hint on challenge 2? I've been stuck on it for quite a while now. I've tried

Admin'" );--
' O/**/R 1=1 LIM/**/IT 1" );--
' OORR 1=1 LIMORIT 1" );--

But none works.

Any help is appreciated!


ynori7
Administrator
Registered: 24.08.11 12:16
Timezone: UTC +2
Posts: 165

Well your first try is on the right track, but you've overcomplicated it a bit. Try simplifying it a bit.

i537.photobucket.com/albums/ff338/ynori77/archenemysig1.jpg


aivilo
Member
Registered: 08.11.13 01:51
Timezone: UTC +0
Posts: 3

Thanks, I got it.

Can you explain to me why Admin' " );-- wouldn't work?
I thought the ' " and ) were needed to prevent a syntax error.


ynori7
Administrator
Registered: 24.08.11 12:16
Timezone: UTC +2
Posts: 165

Sounds like you were trying to close the PHP function, and it doesn't work that way. You're just making a SQL injection.

i537.photobucket.com/albums/ff338/ynori77/archenemysig1.jpg


aivilo
Member
Registered: 08.11.13 01:51
Timezone: UTC +0
Posts: 3

I see, so my input always gets ended at the " ?


ynori7
Administrator
Registered: 24.08.11 12:16
Timezone: UTC +2
Posts: 165

When you have code like this:

mysql_query("select a from b where b.username='$x' and b.password='$y'")

And you enter Admin' " );-- then you'll get:

mysql_query("select a from b where b.username='Admin' \" );--' and b.password='whatever'")

and that's invalid syntax for a SQL query. You're just able to insert SQL code, not PHP code.

i537.photobucket.com/albums/ff338/ynori77/archenemysig1.jpg


khr0x40sh
Member
Registered: 13.05.14 15:00
Timezone: UTC +0
Posts: 2

Is the username case sensitive and is the user name literally "Admin"?


ynori7
Administrator
Registered: 24.08.11 12:16
Timezone: UTC +2
Posts: 165

khr0x40sh wrote:
Is the username case sensitive and is the user name literally "Admin"?

Well part of the challenge is figuring that out, but yeah, you should assume that.

And just FYI, the SQL injection challenges were not working properly due to updates. They should be fixed now.

i537.photobucket.com/albums/ff338/ynori77/archenemysig1.jpg


khr0x40sh
Member
Registered: 13.05.14 15:00
Timezone: UTC +0
Posts: 2

ynori7 wrote:
And just FYI, the SQL injection challenges were not working properly due to updates. They should be fixed now.

This makes me so mad, angry lol, glad it is working now.