phpBB includes/template.php 静态代码注入漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1195315 漏洞类型 输入验证
发布时间 2006-04-20 更新时间 2006-04-21
CVE编号 CVE-2006-1895 CNNVD-ID CNNVD-200604-329
漏洞平台 N/A CVSS评分 6.5
|漏洞来源
https://cxsecurity.com/issue/WLB-2006040092
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200604-329
|漏洞详情
phpBB中的includes/template.php存在直接静态代码注入漏洞。这使得具有写访问权限的远程认证用户可以通过修改模板执行任意PHP代码。修改方式包括:(1)绕过".*"正则表达式以匹配overall_header.tpl中的BEGIN和END语句;或(2)用在bbcode.tpl中的includes/bbcode.php中的eval语句中。
|漏洞EXP
phpBB HTML template files are parsed and executed as PHP code.

This files are not well filtered so a user having access to template files can execute PHP code. You can't trust your designer or template files you found around the web

Example:
Replace ALL switch_enable_pm_popup in overall_header.tpl
By: switch_enable_pm_popup;global $board_config;var_dump($board_config);exit;?>

The part after the first ";" will be executed as PHP code.

bbcode.tpl is parsed in a different way, and any code you place outter of <!-- --> will be executed as PHP code.

Possible solution:
Use ([0-9a-z_.-]+) pattern rather than (.*) in includes/template.php to match BEGIN and END statements.

For bbcode.tpl, change method to parse the template in includes/bbcode.php, do not eval the template.
|参考资料

来源:BID
名称:17573
链接:http://www.securityfocus.com/bid/17573
来源:BUGTRAQ
名称:20060414phpBBtemplatefilecodeexecution
链接:http://www.securityfocus.com/archive/1/archive/1/431017/100/0/threaded
来源:XF
名称:phpbb-template-code-execution(25888)
链接:http://xforce.iss.net/xforce/xfdb/25888
来源:SREASON
名称:769
链接:http://securityreason.com/securityalert/769