Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

SQL Injection security question


ghost's Avatar
0 0

Hi.

I wanted to know if there are any security holes using this query.

mysql_query('SELECT * FROM news WHERE ' . $query);

I try to get informations from other tables or (if possible) even CHANGE values in other tables.

I tried using query=; UPDATE news … or query=– UPDATE news …

but nothing really worked.

Is there any way doing this? Or at least get informations from other tables?

Thanks in advance.


ghost's Avatar
0 0

im not a php or sql person im more fo a pelr person but i think it would be something like

SELECT * FROM users WHERE password=*

to get a list of every users password


ghost's Avatar
0 0

Well, I'm only able to modify the WHERE-condition.

So SELECT * FROM news WHERE is constant and I am able to change everything behind it.

SELECT * FROM news WHERE 1; would list all news - but I don't want to see the boring news. I'd like to see all users for example.


ghost's Avatar
0 0

UNION commands?? I'm assuming there's some reason they wouldn't work or you've tried them already but meh… I have really crappy knowledge of SQL


Mr_Cheese's Avatar
0 1

if you want to select, do a UNION and make sure you finish the sql query with a – if its SQL or /* if its mysql.


ghost's Avatar
0 0

blind sql injection here you could make the $query equal to 1 AND substring(SYSTEM_USER(),1,1)="a" and this could be used to brute force database information.


ghost's Avatar
0 0

try brute force