|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Soapbox Strong opinions about mostly anything (no political or religious content) |
![]() |
|
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
http://imgur.com/QHKXu.png
I hope the programmer has realised now why his participation figures are so low. |
|
|||
|
I'm not really fussed about it, but it actually is relevant to the Programming and Scripting forum. It's a good demonstration of a SQL injection attack on a web app and not my opinion.
|
|
||||
|
Quote:
Not really a question, that's all. No offence intended
__________________
Box: openSUSE 11.2 | (KDE4.3.3) | M2N4-SLI | AMD 64 X2 5200+ | nVidia 8500GT | 4GB RAM Lap: openSUSE 11.2 | Celeron 550 | (KDE4.3.3)"3" | Intel 965 GM | Lenovo R61e | 3GB RAM |
|
|||
|
Err... I'll take 4 from your dozen as I think it belongs in chit-chat since it is somewhat light-hearted and a bit of a joke.
|
|
|||
|
Ok! Put a copy in each forum. Just kidding.
![]() Yes, I thought it was a bit of a joke. Even sounded like a ethnic family name: Robert Drop-Table Names. ![]() But not so funny if there's more important data in on the machine at stake. Wannabe PHP programmers pay attention!
|
|
|||
|
Wait, how's this bad input sanitizing? It seems sanitized to:
"Robert\'); DROP TABLE Names;" as in INSERT INTO Names (name, nameid) VALUES ('Robert\'); DROP TALBE Names;', 123); Otherwise the string would be executed as SQL, not returned to page as data. |
|
|||
|
Look at the number of visitors: 1
Probably because the DROP TABLE was executed and cleared all the previous entries. The programmer probably wrote something like this: Code:
$db->query("INSERT INTO Names VALUES($id,'$name')");
Code:
Robert'); DROP TABLE Names; ('
The moral of the story is, the input value $name should have been sanitised to escape special SQL characters, or statements with placeholders should have been used. |
|
|||
|
Drop table does not clear a table, it drops it. Therefore a select from it would result with an error, missing the table.
So I'm guessing either there was no SQL injection, or the site carries the name through session/cache to the next page. The number of certificates issued (#1) suggests there was a SQL injection, but: - table would be dropped, not truncated - would result with an SQL error selecting from non-existent table - dropping the table would make it impossible to COUNT and get #1, UNLESS the site automagically recreates missing tables which I doubt. In which case, the name would be empty. |
|
|||
|
You don't know what else the application does after that particular part of the code, maybe it recreates the table if it doesn't exist. Or maybe the code simply assumes that no rows is 0, even though SELECT COUNT(*) fails and continues to increment that by 1. That welcome message could be code doing something like this:
Code:
echo "Welcome $name, you are visitor $count"; |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|