现象:
调查思路:
浏览器F12或右键查看Flash展示处的html源码:- <embed width="438" height="304"
- src="static/image/common/doodle.swf?fid=a_magic_doodle&oid=comment_message&from=&config=http%3A%2F%2Fbbs.tsingfun.com%2Fhome.php%3Fmod%3Dmisc%26ac%3Dswfupload%26op%3Dconfig%26doodle%3D1"
- quality="high" wmode="transparent" allowscriptaccess="always" type="application/x-shockwave-flash">
复制代码
config参数url解码后:http://域名/home.php?mod=misc&ac=swfupload&op=config&doodle=1
访问可以看到是一些配置项,包括上面按钮本应显示的文字。
由此可以初步判定,Flash没有正确加载url中的配置项。
将doodle.swf进行反编译,查看加载配置相关的代码,如下:- internal function loadConfig():void
- {
- var loc1:*=new RegExp("^(https?|ftp|gopher|news|telnet|mms|rtsp):\/\/", "i");
- if (this.configURL.match(loc1) === null && this.configURL.indexOf("://") == -1)
- {
- this.xmlRequest = new flash.net.URLRequest(this.configURL);
- this.xmlLoader = new flash.net.URLLoader(this.xmlRequest);
- this.xmlLoader.addEventListener(flash.events.Event.COMPLETE, parseConfig);
- }
- return;
- }
复制代码
上面这个if逻辑是:url不以http开头且不包含“://”字符串才能解析,但是外面config传值又是以“http://”开头的,这里不得不吐槽一下Discuz团队,是否是两个小组的人员没有商量好接口,还是判断逻辑有误呢?
由于修改Flash代价稍高,因此笔者决定修改config传值,去掉前面的“http://”:
修改sourceclassmagicmagic_doodle.php
$config = urlencode(getsiteurl().'home.php?mod=misc&ac=swfupload&op=config&doodle=1');
改为:
$config = urlencode('home.php?mod=misc&ac=swfupload&op=config&doodle=1');
现在运行,如图:
不过,此时保存按钮功能还是有些问题,下次再细调了。
今天继续研究点击“保存”按钮没有任何反应的问题。
分析思路:
没错,继续反汇编doodle.swf调试as源代码,别无他法了。这里搞个便民反编译源文件供大家参考
doodle反编译源文件.zip (72.38 KB, 下载次数: 1) 。
我们跟踪数据post后的响应数据:- internal function makeComplete(arg1:flash.events.Event):void
- {
- trace("makeComplete");
- var event:flash.events.Event;
- var result:XML;
- var msg:String;
- var loader:flash.net.URLLoader;
- var request:flash.net.URLRequest;
- var variables:flash.net.URLVariables;
- var loc1:*;
- result = null;
- msg = null;
- loader = null;
- request = null;
- variables = null;
- event = arg1;
- try
- {
- trace(event.currentTarget.data);
- ......
复制代码
结果是一个html文件,效果如下:
继续查找错误原因,发现是由于post数据中没有带hash值,_xss_check()失败导致。
这里,再次吐槽Discuz团队,你们做了充分测试了吗?
还是之前那句话,修改Flash源码代价蛮高,笔者不想弄。
临时去掉xss检验解决问题。
home.php 顶部加上一个定义就ok了,代码如下:- if ($_GET['mod'] == 'misc' && $_GET['ac'] == 'swfupload' && $_GET['op'] == 'doodle') {
- define('DISABLEXSSCHECK', '1');
- }
复制代码 解决后截图如下:
原文:http://bbs.tsingfun.com/thread-457-1-1.html
|