Blind SQL Injection

2 Cevap php

Kör SQL / XPath enjeksiyonu: benim sayfada Acunetix kullandığınızda i olsun

header: GET /file.php?id=2'+and+31337-31337=0+--+&page=2

response:

no files found

(sometimes it shows results)

İşte benim php kodu:

$id = (int) htmlentities($_GET['id']);
$fileid = mysql_real_escape_string($id);

Sorgu:

SELECT * FROM `files` WHERE `id` = '".$fileid."'

what am i doing wrong? can someone erase my database just with this? im also getting the same message at some queries almost equal to that one but that also have limit 0,1

Ben sayfa numaralarını kullanıyorum (ben bu senaryoda nerede bazı enjeksiyonlar sabit) ama örnek ben onun bunu kullanarak değil gaved

2 Cevap

Int id Döküm zaten SQL enjeksiyon saldırıları (bildiğim kadarıyla) herhangi bir şans önlemek gerekir.

$id = (int) $_GET["id"];
$Query = "SELECT * FROM files WHERE id = $id;";

file.php? id = en kötü durumda bu id eşleşen herhangi bir kaydı bulamazsınız böylece abcabc, = 0 $ id neden olur, ama $ id çünkü bu tamsayı döküm herhangi bir dize (özellikle değil SQL) içerir asla.

Bunu bilmeni istedim umuyoruz.

Ben Acunetix gerçekten adamcağız olduğuna inanıyorum, hiç bir SQL injection açığı var gibi görünüyor değil.