Skip to content

Commit

Permalink
开源
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxxbxxxxx committed Apr 22, 2020
1 parent a19c401 commit 99ee76f
Show file tree
Hide file tree
Showing 181 changed files with 8,293 additions and 2 deletions.
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3
LABEL maintainer="r4v3zn <woo0nise@gmail.com>" version="0.1.0" description="Vulfocus for Docker"
EXPOSE 80
RUN mkdir /vulfocus-api/
WORKDIR /vulfocus-api/
ADD vulfocus-api/ /vulfocus-api/
ENV VUL_IP=""
RUN mv /etc/apt/sources.list /etc/apt/sources.list.back && \
cp /vulfocus-api/sources.list /etc/apt/sources.list && \
apt update && \
apt install nginx -y && \
rm -rf /var/www/html/* && \
cp /vulfocus-api/default /etc/nginx/sites-available/default && \
cp /vulfocus-api/default /etc/nginx/sites-enabled/default && \
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package -r requirements.txt && \
chmod u+x /vulfocus-api/run.sh
ADD dist/ /var/www/html/
CMD ["sh", "/vulfocus-api/run.sh"]
168 changes: 168 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
## 安装

系统为前后端分离项目,`vulfocus-api` 为后端项目、`vulfocus-frontend` 为前端项目。

### 快速安装

```
docker pull vulfocus/vulfocus:latest
docker run -d -p 80:80 -v /var/run/docker.sock:/var/run/docker.sock -e VUL_IP=xxx.xxx.xxx.xxx vulfocus/vulfocus
```

其中 `-v /var/run/docker.sock:/var/run/docker.sock` 为 docker 交互文件, `-e VUL_IP=xxx.xxx.xxx.xxx` 为 Docker 服务器IP,不能为 127.0.0.1。

默认账户密码为 `admin/admin`

![](./imgs/1.png)

### Vulfocus API

环境:

- 语言:python3
- 数据库:sqlite3
- 框架:Django
- API:djangorestframework

安装 Docker:

[https://docs.docker.com/engine/install/](https://docs.docker.com/engine/install/)

安装依赖:

```
pip install -r requirements.txt
```

创建数据库:

```
python manage.py migrate
```

创建管理员用户:

```
python manage.py createsuperuser
```

靶场配置:

1. 配置 Docker URL(`vulfocus/settings.py`),默认为:`tcp://127.0.0.1:2375`,修改为 Docker 服务器的 IP。

2. 配置 VUL_IP(`vulfocus/settings.py`),修改为 Docker 服务器的 IP。

启动 API 后端:

```
python manage.py runserver 0.0.0.0:8000
```

#### 部署

##### Docker 配置

配置 Docker 2375 端口(可根据实际情况进行修改),修改 docker 配置文件,加入以下信息:

```
ExecStart=/usr/bin/dockerd -H tcp://127.0.0.1:2375 -H unix://var/run/docker.sock \
```

配置上传文件大小,修改 `nginx.conf` 文件,http 中加入:

```
client_max_body_size 2048M;
```

其中 2048M(2GB) 为上传文件最大限制,可根据实际进行修改,最小配置为 200M 。

##### Linux 部署

修改 nginx 配置目录 `sites-enabled``default` 文件 ,server 节点添加以下代码:

```
location /api/ {
proxy_pass http://127.0.0.1:8000/;
}
```

##### Windows 部署

修改 nginx 配置文件 `nginx.conf` ,server 添加以下代码:

```
location /api/ {
proxy_pass http://127.0.0.1:8000/;
}
```

##### nginx 参考配置文件

以下为 nginx 参考配置文件:

```
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 2048M;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /api/ {
proxy_pass http://127.0.0.1:8000/;
}
}
}
```

### Vulfocus Frontend

vulfocus 前端项目,通过 Element-ui + VUE 构建。

环境:
- UI:Element UI
- 框架:vue
- node:v12.16.2
- npm:6.14.4

#### 部署

##### 项目构建

安装依赖:

```shell script
npm install
```

构建项目:
```
npm run build:prod
```

将 dist 目录部署至 nginx 中,默认 nginx 静态目录位于 `/var/www/html`

##### 发行版本

通过 [https://github.com/fofapro/vulfocus/releases](https://github.com/fofapro/vulfocus/releases) 下载最新发布的版本。

#### 开发

```shell script
npm run dev
```

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright [2020] [fofapro and r4v3zn]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
128 changes: 127 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,127 @@
# vulfocus

<h1 align="center"> Welcome to Vulfocus 🚀 </h1>

Vulfocus 是一个漏洞集成平台,将漏洞环境 docker 镜像,放入即可使用,开箱即用。

<p>
<img src="https://img.shields.io/github/stars/fofapro/vulfocus.svg?style=flat-square" />
<img src="https://img.shields.io/github/release/fofapro/vulfocus.svg?style=flat-square" />
<img src="https://img.shields.io/github/release/fofapro/vulfocus.svg?color=blue&label=update&style=flat-square" />
<img src="https://img.shields.io/github/license/fofapro/vulfocus?style=flat-square" />
</p>

在线演示:[http://vulfocus.fofa.so/](http://vulfocus.fofa.so/)

## 背景

现在阶段网络靶场平台是遍地开花,让人看的眼花缭乱,但商业化产品居多,还有一些类似 dvwa、 sqli-labs这类的开源项目,但是漏洞环境比较固定,使用完一次后就失去其作用。当你需要某个环境的时候,你可能还需要去 https://hub.docker.com/ 官网上找,但每次启动的流程会比较繁琐,因为每个镜像的启动命令可能都不太一样,而且一但环境多了很不好管理,需要启动同一个框架两个不同版本的漏洞环境的时候,就需要修改一些端口、配置文件等等很麻烦,甚至很多场景是不满足的,之前关于漏洞环境镜像使用多的是vulhub,但是作为企业,高校等以及相关的培训,单纯的漏洞环境不一定能满足使用的需求,所以我们基于当下的一些靶场项目做出了小小的改进来符合我们一些需求,比如,增加flag的形式,积分的形式,来满足一些考核与验证的需求,于是 Vulfocus 就诞生了。

## 认识 Vulfocus

因为 Vulfocus 一个漏洞集成平台,所以可以无限向里添加漏洞环境没有限制,前提是你的内存足够大。因为漏洞环境是docker镜像的原因每次重新启动漏洞环境都会还原,不用出现你会对环境造成破坏下次无法启动的现象。

Vulfocus 的 docker 仓库 [https://hub.docker.com/u/vulfocus](https://hub.docker.com/u/vulfocus)

### Vulfocus的特性


1. 启动:一键漏洞环境启动,方便简单。
2. 自带 Flag 功能:每次启动 flag 都会自动更新,明确漏洞是否利用成功。
3. 带有计分功能也可适用于相关安全人员能力的考核。
4. 兼容 [Vulhub](https://vulhub.org/)[Vulapps](http://vulapps.evalbug.com/) 中所有漏洞镜像。


## ⬇️ 下载及安装

🏠 请参考 [INSTALL.md](./INSTALL.md) 进行安装。

⬇️ 发行版下载 [https://github.com/fofapro/vulfocus/releases](https://github.com/fofapro/vulfocus/releases)

### ✨ 使用

![](./imgs/register&login.gif)

1. 安装完成后,访问80端口

2. 用设置好的管理员账户登录

3. 首页为漏洞集成页面,刚开始是没有漏洞镜像的需要从 [https://hub.docker.com/](https://hub.docker.com/) 网站拉取镜像,或自己以tar包的形式上传。

漏洞镜像的拉取和上传(**需管理员权限**):

(1)、在进行管理中,添加功能

![](./imgs/upload_image_pull.gif)

![](./imgs/upload_image_file.gif)

(2)、分别填入漏洞名称、镜像、rank、描述

- 镜像又分为文件和文本
- 文本:是从 [https://hub.docker.com/u/vulfocus](https://hub.docker.com/u/vulfocus) 官网拉取镜像。内容为如: `vulfocus/webmin-cve_2019_15107`
- 文件:本地漏洞镜像打成tar包的形式进行上传。

4. 下载完成后点击启动即可。

![](./imgs/tp5_rce.gif)

5. 镜像启动后,会在环境里写入一个 flag (默认 flag 会写入 **/tmp/** 下),读取到 flag 后填入 flag 窗口,镜像会自动关闭,如需重新启动,需强刷一下,然后再次点击启动即可。


## 🛠贡献漏洞镜像

初期 Vulfocus 的漏洞镜像会较少,可能无法满足你的需求,所以非常期望大家来一起维护 Vulfocus,当你发现你的一些漏洞环境在 Vulfocus 中找不到时,可以提交供大家使用。一个有问题的环境可能会影响到使用者的情绪。因此我们对社区提交的漏洞环境会进行审核。贡献者在提交漏洞环境的时候,可提供相应的复现工具或流程,加速环境的审核。

### 方式

- 提交 dockerfile
- 也可以上传到 [https://hub.docker.com](https://hub.docker.com) ,把镜像的名称提供给我们,镜像名称的命令规则如:框架(CMS、组件)-漏洞编号,例如:`vulfocus/spring-cve_2017_8046`


- 例:
vulfocus/webmin-cve_2019_15107
vulfocus/spring-cve_2017_8046

### 流程

- fork [vulfocus](https://github.com/fofapro/vulfocus) 至个人项目,然后 clone 项目。

- 提交 dockerfile 至 [images](./images/) 文件夹中创建漏洞名称,然后将 dockerfile 放置该目录下,最后将环境信息提交至 [`images/README.md`](./images/README.md)
- 贡献者以 PR 的方式向 github Vulfocus 社区仓库内提交 漏洞环境, 提交位置: [https://github.com/fofapro/vulfocus/dockerfile/](https://github.com/fofapro/vulfocus/dockerfile/)
- 我们会根据提供的 dockerfile,确定镜像环境是否可用。
- 审核完成后镜像会放进 https://hub.docker.com/u/vulfocus 仓库供大家使用。

## 📝 讨论区

如有问题可以在 GitHub 提 issue, 也可在下方的讨论组里

GitHub issue: [https://github.com/fofapro/vulfocus/issues](https://github.com/fofapro/vulfocus/issues)

微信群: 扫描以下二维码加我的个人微信,会把大家拉到 Vulfocus 官方微信群。

<img src="./imgs/wechat.jpeg" widht="500px" height="500px" />

## 致谢

- [Vue Element Admin](https://github.com/PanJiaChen/vue-element-admin)
- [Vulhub](https://vulhub.org/)

## 声明

该项目会收集了当下比较流行的漏洞环境,若有侵权,请联系我们!

## FAQ

镜像启动后立即访问地址失败?

1. 根据镜像的大小,启动时间会有不同的延迟,一般在几秒以内。

提交完 flag 后会有卡住?

1. 在提交完正确flag后,会进行镜像关闭的动作,所以会有几秒的延迟。

拉取镜像时一直卡在哪里

1. 由于网络延迟或镜像太大的原因时间会长一点。

2. 镜像名称填错,也会卡在哪里,建议强刷一下。
Binary file added images/.DS_Store
Binary file not shown.
32 changes: 32 additions & 0 deletions images/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Vulfocus 镜像维护目录,该目录中存储 Vulfocus 所有的 Dockerfile 信息,提交者需在此文件夹中创建漏洞对应的环境目录,然后在此目录中编译 Dockerfile 文件,最后将漏洞镜像信息提交至该文件中。



| id | 漏洞名称 | 镜像名称 | 描述 |
| :--- | :--------------- | :--------------------------------------------------- | :--------------- |
| 1 | CVE-2020-12409 | `docker pull vulfocus/solr-cve_2020_12409` | CVE-2020-12409 |
| 2 | CVE-2020-7961 | `docker pull vulfocus/liferay-cve_2020_7961` | CVE-2020-7961 |
| 3 | CVE-2020-1938 | `docker pull vulfocus/tomcat-cve_2020_1938` | CVE-2020-1938 |
| 4 | CNVD-2019-22238 | `docker pull vulfocus/fastjson-cnvd_2019_22238` | CNVD-2019-22238 |
| 5 | CVE-2019-17564 | `docker pull vulfocus/dubbo-cve_2019_17564` | CVE-2019-17564 |
| 6 | CVE-2019-15107 | `docker pull vulfocus/webmin-cve_2019_15107` | CVE-2019-15107 |
| 7 | CVE-2019-8942 | `docker pull vulfocus/wordpress-cve_2019_8942` | CVE-2019-8942 |
| 8 | CNVD-2018-24942 | `docker pull vulfocus/thinkphp-cnvd_2018_24942` | CNVD-2018-24942 |
| 9 | CVE-2018_1000861 | `docker pull vulfocus/jenkins-cve2018_1000861` | CVE-2018_1000861 |
| 10 | CVE-2018-7600 | `docker pull vulfocus/drupal-cve_2018_7600` | CVE-2018-7600 |
| 11 | CVE-2017_1000353 | `docker pull vulfocus/jenkins-cve2017_1000353` | CVE-2017_1000353 |
| 12 | CVE-2017-12636 | `docker pull vulfocus/couchdb-cve_2017_12636` | CVE-2017-12636 |
| 13 | CVE-2017-12615 | `docker pull vulfocus/tomcat-cve_2017_12615` | CVE-2017-12615 |
| 14 | CVE-2017-12149 | `docker pull vulfocus/jboss-cve_2017_12149` | CVE-2017-12149 |
| 15 | CVE-2017-9791 | `docker pull vulfocus/struts2-cve_2017_9791` | CVE-2017-9791 |
| 16 | CVE-2017_8046 | `docker pull vulfocus/vulfocus/spring-cve_2017_8046` | CVE-2017_8046 |
| 17 | CVE-2017-7504 | `docker pull vulfocus/jboss-cve_2017_7504` | CVE-2017-7504 |
| 18 | CVE-2017-5941 | `docker pull vulfocus/nodejs-cve_2017_594` | CVE-2017-5941 |
| 19 | CVE-2017-5638 | `docker pull vulfocus/struts2-cve_2017_5638` | CVE-2017-5638 |
| 20 | CVE-2017-3066 | `docker pull vulfocus/coldfision-cve_2017_3066` | CVE-2017-3066 |
| 21 | CNVD-2017-02833 | `docker pull vulfocus/fastjson-cnvd_2017_02833` | CNVD-2017-02833 |
| 22 | CVE-2016-10033 | `docker pull vulfocus/wordpress-cve_2016_10033` | CVE-2016-10033 |
| 23 | CVE-2016-9565 | `docker pull vulfocus/nagios-cve_2016_9565` | CVE-2016-9565 |
| 24 | CVE-2016-4437 | `docker pull vulfocus/shiro-cve_2016_4437` | CVE-2016-4437 |
| 25 | CVE-2014-3120 | `docker pull vulfocus/elasticsearch-cve_2014_3120` | CVE-2014-3120 |

14 changes: 14 additions & 0 deletions images/Struts-016/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM tomcat:8-jre8
MAINTAINER vulfocus@bmh.com

ENV WAR_URL https://github.com/sie504/Struts-S2-xxx/raw/master/s2-016.war

WORKDIR /tmp

RUN set -ex \
&& rm -rf /usr/local/tomcat/webapps/* \
&& chmod a+x /usr/local/tomcat/bin/*.sh \
&& wget -qO /usr/local/tomcat/webapps/ROOT.war $WAR_URL

EXPOSE 8080
CMD ["/usr/local/tomcat/bin/catalina.sh", "run"]
Binary file added imgs/.DS_Store
Binary file not shown.
Binary file added imgs/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/register&login.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/tp5_rce.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/upload_image_file.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/upload_image_pull.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/wechat.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added vulfocus-api/.DS_Store
Binary file not shown.
15 changes: 15 additions & 0 deletions vulfocus-api/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 99ee76f

Please sign in to comment.