Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1400
  • 博文数量: 2
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 30
  • 用 户 组: 普通用户
  • 注册时间: 2013-05-25 17:07
文章分类
文章存档

2014年(1)

2013年(1)

我的朋友
最近访客

分类: 其他平台

2014-06-06 16:42:37

wordpress相对门路泄漏+剖析





无意中改下就暴路径了,应当所有版本都有,测试了正式版跟多少个beta版,详细版本漏洞代码所在行数不同罢了,又是数组和变量的老问题,信任良多处所都还存在。
问题出在搜寻的参数,XXX./index.phps 改成 XXX./index.phps..
Warning: rawurlencode() expects parameter 1 to be string, array given in /home/xxx/public_html/wpincludes/classes.php on line 227

问题很小,忽然想起一件很有意思的事,就看了下代码,写个比拟完全点的文档

看URL就晓得变量s的问题,找sgeneraltemplate.php 878行:

function the_search_query()
global s;
echo wp_specialchars( stripslashes( s), 1 );
怎么过滤的,找函数wp_specialchars:
formatting.php 107行:

function wp_specialchars( text, quotes 0 )
// Like htmlspecialchars except don't doubleencode HTML entities
text str_replace(' text);
text str_replace(' text);
text preg_replace('/ '(.^#.)(!.az14. 1,8 ;))/', ' 1', text);
text str_replace(' ', ' ', text);
text str_replace(' ', ' ', text);
if ( 'double' quotes )
text str_replace('"', ' ', text);
elseif ( 'single' quotes )
text str_replace("'", ' ', text);
elseif ( quotes )
text str_replace('"', ' ', text);
text str_replace("'", ' ', text);

return text;
过滤的很好但不是要害,看报错找rawurlencode()函数:
classes.php 222行:

function build_query_string()
this query_string '';
foreach (array_keys( this query_vars) as wpvar)
if ( '' ! this query_vars. wpvar. )
this query_string . (strlen( this query_string) 1) '' : '
this query_string . wpvar . '' . rawurlencode( this query_vars. wpvar.);

wpvar被传到rawurlencode函数里,导致函数犯错,那 wpvar的值是什么呢·跟变量s有什么关联·往上看,第4行:

var public_query_vars array('m', 'p', 'posts', 'w', 'cat', 'withments', 'withoutments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'ments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots');前面s已经global了,看到s被包括在数组中,接着找 wpvar,137行:

this public_query_vars apply_filters('query_vars', this public_query_vars);

for ( i0; i count( this public_query_vars); i + 1)
wpvar this public_query_vars. i.;
if (isset( this extra_query_vars. wpvar.))
this query_vars. wpvar. this extra_query_vars. wpvar.;
elseif (isset( GLOBALS. wpvar.))
this query_vars. wpvar. GLOBALS. wpvar.;
elseif (!empty( _POST. wpvar.))
this query_vars. wpvar. _POST. wpvar.;
elseif (!empty( _GET. wpvar.))
this query_vars. wpvar. _GET. wpvar.;
elseif (!empty( perma_query_vars. wpvar.))
this query_vars. wpvar. perma_query_vars. wpvar.;
wpvar这里取得了s的值,接着就把变量s带入函数rawurlencode里做转换,这里把变量s改为数组提交,破绽就发生了,很明白的看到报错提醒:
Warning: rawurlencode() expects parameter 1 to be string, array given in....

over!

阅读(36) | 评论(0) | 转发(0) |
0

上一篇:抢先玩上 Firefox OS 移动操作系统,使用火

下一篇:没有了

给主人留下些什么吧!~~