php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53210 mysql_fetch_assoc (mysql_query (SQL) inside a while loop can cause DoS
Submitted: 2010-10-30 22:54 UTC Modified: 2010-11-10 16:39 UTC
Votes:3
Avg. Score:2.7 ± 1.2
Reproduced:2 of 3 (66.7%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: yoyahack at undersecurity dot net Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.3.3 OS: Fedora 13
Private report: No CVE-ID: None
 [2010-10-30 22:54 UTC] yoyahack at undersecurity dot net
Description:
------------
If income mysql_fetch_assoc (mysql_query (SQL) within a while loop cause denial 
of service

Test script:
---------------
<?php 
$link = mysql_connect('127.0.0.1','user', 'pass');
mysql_select_db('db', $link);

while($row = mysql_fetch_assoc(mysql_query('select * from table', $link)))
{
echo $row['id'];
}
?>


Expected result:
----------------
it generates an infinite loop that never ends


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-01 08:12 UTC] exilianmelody at google dot com
hi,buddy, in my thought,you just have a structure mistake,because in while loop,it have to have a static value,but your argument is a dynamic generated,so everytime anyhow the while loop is true,and each output record is the first item in your table,except your table is empty.solve it below:

$link = mysql_connect('127.0.0.1','root', 'root');

mysql_select_db('test', $link);

$resouce = mysql_query('select * from table', $link);

while($row = mysql_fetch_assoc($resource))
{
	echo $row['col1'].nl2br('/r');
}
 [2010-11-01 08:21 UTC] exilianmelody at gmail dot com
i am so sorry for leaved my incorrect mail adress,:)
 [2010-11-10 16:39 UTC] Kalle@php.net
-Status: Open +Status: Bogus
 [2010-11-10 16:39 UTC] Kalle@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC