Giter Site home page Giter Site logo

chaitin / veinmind-tools Goto Github PK

View Code? Open in Web Editor NEW
1.5K 18.0 179.0 20.57 MB

veinmind-tools 是由长亭科技自研,基于 veinmind-sdk 打造的容器安全工具集

Home Page: https://veinmind.chaitin.com/docs/

License: MIT License

Go 73.60% Shell 0.08% HTML 2.67% Python 6.71% Dockerfile 4.38% Smarty 0.30% Open Policy Agent 7.36% Makefile 4.89%
docker security image-security containerd container-security cloud-native cloud-security

veinmind-tools's Introduction

veinmind-tools

Documentation

veinmind-tools 是由长亭科技自研,牧云团队孵化,基于 veinmind-sdk 打造的容器安全工具集

veinmind, 中文名为问脉,寓意 容器安全见筋脉,望闻问切治病害。 旨在成为云原生领域的一剂良方

中文文档 | English

🔥 Demo

问脉已接入 openai, 可以使用 openai 对扫描的结果进行人性化分析,让您更加清晰的了解本次扫描发现了哪些风险。

🕹️ 快速开始

1. 确保机器上正确安装 docker

docker info

2. 安装 veinmind-runner 镜像

docker pull registry.veinmind.tech/veinmind/veinmind-runner:latest

3. 下载 veinmind-runner 平行容器启动脚本

wget -q https://download.veinmind.tech/scripts/veinmind-runner-parallel-container-run.sh -O run.sh && chmod +x run.sh

4. 快速扫描本地镜像/容器

./run.sh scan [image/container]

5. 使用 openAI 智能分析

./run.sh scan [image/container] --enable-analyze --openai-token  <your_openai_token>

注: 使用 openAI 时,请确保当前网络能够访问openAI 平行容器启动时,需要手动通过 docker run -e http_proxy=xxxx -e https_proxy=xxxx 设置代理(非全局代理的场景下)

6. 生成 报告

./run.sh scan [image/container] --format=html,cli

报告将在当前目录下生成一个report.htmlreport.json 可以通过,来传入多个报告格式,如--format=html,cli,json将输出三份不同的报告。

🔨 工具列表

工具 功能
veinmind-runner 扫描工具运行宿主
veinmind-malicious 扫描容器/镜像中的恶意文件
veinmind-weakpass 扫描容器/镜像中的弱口令
veinmind-log4j2 扫描容器/镜像中的log4j2漏洞
veinmind-minio 扫描容器/镜像中的minio漏洞
veinmind-sensitive 扫描镜像中的敏感信息
veinmind-backdoor 扫描镜像中的后门
veinmind-history 扫描镜像中的异常历史命令
veinmind-vuln 扫描容器/镜像中的资产信息和漏洞
veinmind-webshell 扫描镜像中的 Webshell
veinmind-unsafe-mount 扫描容器中的不安全挂载目录
veinmind-iac 扫描镜像/集群的IaC文件
veinmind-escape 扫描容器/镜像中的逃逸风险
veinmind-privilege-escalation 扫描容器/镜像中的提权风险
veinmind-trace 扫描容器中的入侵痕迹

PS: 目前所有工具均已支持平行容器的方式运行

🧑‍💻 编写插件

可以通过 example 快速创建一个 veinmind-tools 插件, 具体查看 veinmind-example

☁️ 云原生设施兼容性

名称 类别 是否兼容
Jenkins CI/CD ✔️
Gitlab CI CI/CD ✔️
Github Action CI/CD ✔️
DockerHub 镜像仓库 ✔️
Docker Registry 镜像仓库 ✔️
Harbor 镜像仓库 ✔️
Docker 容器运行时 ✔️
Containerd 容器运行时 ✔️
Kubernetes 集群 ✔️

🛴 工作原理

🏘️ 联系我们

  1. 您可以通过 GitHub Issue 直接进行 Bug 反馈和功能建议。
  2. 扫描下方二维码可以通过添加问脉小助手,以加入问脉用户讨论群进行详细讨论

✨ CTStack

veinmind-tools 现已加入 CTStack 社区

✨ 404星链计划

veinmind-tools 现已加入 404星链计划

✨ Star History

Star History Chart

veinmind-tools's People

Contributors

asjdf avatar bigcircle-sec avatar ch3cke avatar d1nfinite avatar dvkunion avatar ek1ng avatar huzai9527 avatar jqqzzz avatar l2yyd5 avatar testwill avatar tsuki124 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

veinmind-tools's Issues

希望支持mysql8版本的caching_sha2_password弱密码检测,减少漏报

检测mysql弱密码出现较多漏报

情况如下
查看项目代码,是在8版本的数据库文件mysql.ibd读取进行检测,并且只支持插件mysql_native_password,但是8版本默认的密码插件是caching_sha2_password,会有多个密码账号配置跳过该弱密码检测。对于8以下mysql版本,密钥文件存储于user.myd文件,默认插件是mysql_native_password。

希望支持mysql8版本的caching_sha2_password弱密码检测

./run.sh运行报错:Error: readlink /host/proc/1/ns/pid: permission denied

Bug 具体描述
./run.sh scan container ea7d6c3d7bc7直接报错:Error: readlink /host/proc/1/ns/pid: permission denied

复现步骤

  1. 拉取镜像
    docker pull registry.veinmind.tech/veinmind/veinmind-runner:latest
  2. 下载 [veinmind-runner]平行容器启动脚本
    wget -q https://download.veinmind.tech/scripts/veinmind-runner-parallel-container-run.sh -O run.sh && chmod +x run.sh
  3. 扫描本地容器,出现错误
$ ./run.sh scan container ea7d6c3d7bc7
Error: readlink /host/proc/1/ns/pid: permission denied
Usage:
  veinmind-runner scan container [flags] target

Examples:

1. scan dockerd container (all)
veinmind-runner scan container dockerd:*

相关截图
image

环境

  • linux:Ubuntu 18.04.6
  • Docker 版本: Docker version 20.10.21
  • libveinmind 版本:
  • 问脉镜像版本:
  • 代码版本:

补充说明
查看了下run.sh文件,内容如下:

#!/bin/bash

docker run --rm -v /:/host -v `pwd`:/tool/resource -v /var/run/docker.sock:/var/run/docker.sock registry.veinmind.tech/veinmind/veinmind-runner $*

加上特权参数--privileged后运行就可以了。

不能生成Json格式的结果

Bug 具体描述
veinmind-tools 不能更改检测果内容的格式
复现步骤

  1. ./veinmind-run.sh scan image a2127c821068 -o json
  2. veinmind-run.sh 中的内容为:'#!/bin/bash

docker container run --rm -v /:/host -v pwd:/tool/resource -v /var/run/docker.sock:/var/run/docker.sock registry.veinmind.tech/veinmind/veinmind-runner $*'

相关截图
json

环境

  • Docker 版本: 24.0.2
  • libveinmind 版本: libveinmind-devel-1.9.21-1.x86_64
  • 问脉镜像版本:latest
  • 代码版本:

wsl2 无法使用

wsl2环境
docker 20.10.7

执行 ./run.sh scan-host、

提示:
docker: Error response from daemon: path / is mounted on / but it is not a shared mount.
See 'docker run --help'.

panic: runtime error: invalid memory address or nil pointer dereference

Bug 具体描述

复现步骤
docker run --rm --mount 'type=bind,source=/,target=/host,readonly,bind-propagation=rslave' --privileged veinmind-backdoor scan container

相关截图
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1e9a83f]

goroutine 1 [running]:
github.com/chaitin/veinmind-tools/plugins/go/veinmind-backdoor/service.rootkitContainerCheck({0x7fab80517148, 0xc000442000})
github.com/chaitin/veinmind-tools/plugins/go/veinmind-backdoor/service/rootkit.go:217 +0x19f
github.com/chaitin/veinmind-tools/plugins/go/veinmind-backdoor/utils.ContainersScanRun({0x25406d0?, 0xc000442000})
github.com/chaitin/veinmind-tools/plugins/go/veinmind-backdoor/utils/utils.go:26 +0x105
main.scanContainer(0xc00049a8e0?, {0x25406d0, 0xc000442000})
./cli.go:82 +0x45
github.com/chaitin/libveinmind/go/cmd.(*Index).MapContainerCommand.func1.1({0x253b240?, 0xc00049a8e0?}, 0xe18c01?, 0x23a9f60, 0xc53d46?)
github.com/chaitin/[email protected]/go/cmd/container.go:127 +0xc6
github.com/chaitin/libveinmind/go/cmd.(*Index).MapContainerCommand.func1(0x1fa6980?, {0x253b240, 0xc00049a8e0}, {0xc0000b6200?, 0x1f, 0xc0000f9be0?})
github.com/chaitin/[email protected]/go/cmd/container.go:128 +0xb3
github.com/chaitin/libveinmind/go/cmd.(*Index).MapContainerIDsCommand.func1(0x0?, {0x324c6c0, 0x0, 0x3000000000000000?}, {0x21e7980?, 0xc00049a8e0?})
github.com/chaitin/[email protected]/go/cmd/container.go:98 +0x22a
github.com/chaitin/libveinmind/go/cmd.dockerMode.Invoke({}, 0xc0000f9c98?, {0x324c6c0, 0x0, 0x0}, 0xc0004321e0)
github.com/chaitin/[email protected]/go/cmd/docker.go:64 +0xfa
github.com/chaitin/libveinmind/go/cmd.(*Index).MapModeCommand.func1(0x0?, {0x324c6c0, 0x0, 0x0})
github.com/chaitin/[email protected]/go/cmd/mode.go:75 +0xb6
github.com/chaitin/libveinmind/go/cmd.(*Index).MapPluginCommand.func1(0x313b380?, {0x324c6c0?, 0x0?, 0x0?})
github.com/chaitin/[email protected]/go/cmd/index.go:140 +0xa7
github.com/spf13/cobra.(*Command).execute(0x313b380, {0x324c6c0, 0x0, 0x0})
github.com/spf13/[email protected]/command.go:916 +0x862
github.com/spf13/cobra.(*Command).ExecuteC(0x321c0a0)
github.com/spf13/[email protected]/command.go:1040 +0x3b4
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/[email protected]/command.go:968
main.main()
./cli.go:132 +0x25

环境(空项可以不填)

  • Docker 版本: Docker version 26.1.3, build b72abbb
  • libveinmind 版本:最新版

希望有个全插件版本

目前的插件都需要一个个装,命令也是一条一条敲,能否将所有插件整合到主程序runner里,用一条命令扫描所有插件,或者支持用参数来选择插件。
谢谢

导出报告

Available Commands:
analyze Analyze Veinmind Report With OpenAI.
authz Authz as docker plugin
completion Generate the autocompletion script for the specified shell
generate Generate relevant information
help Help about any command
list List relevant information
scan Scan cloud native objects security, include image/container/iac

Flags:
-e, --exit-code int exit-code when veinmind-runner find security issues
-g, --glob string specifies the pattern of plugin file to find
-h, --help help for veinmind-runner
-o, --output string output filepath of report
--threads int threads for scan action (default 5)

flag -o好像没用,只能在本地导出report.json,可以自定义导出报告路径么?

拉取最新镜像 Error: probe docker rootfs: stat /host/host/var/lib/docker: no such file or directory

Bug 具体描述

复现步骤

  1. 拉取最新镜像
    veinmind/veinmind-runner latest 6fc7c3f031f7 42 hours ago 1.41GB

扫描目标本地镜像
nvidia/cuda:12.1.0-runtime-ubuntu20.04

相关截图
image
image

做了软链接:
image

环境(空项可以不填)

  • Docker 版本:
    Client: Docker Engine - Community
    Version: 19.03.2
    API version: 1.40
    Go version: go1.12.8
    Git commit: 6a30dfc
    Built: Thu Aug 29 05:28:55 2019
    OS/Arch: linux/amd64
    Experimental: false

Server: Docker Engine - Community
Engine:
Version: 19.03.2
API version: 1.40 (minimum version 1.12)
Go version: go1.12.8
Git commit: 6a30dfc
Built: Thu Aug 29 05:27:34 2019
OS/Arch: linux/amd64
Experimental: true
containerd:
Version: 1.2.6
GitCommit: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
runc:
Version: 1.0.0-rc8
GitCommit: 425e105d5a03fabd737a126ad93d62a9eeede87f
docker-init:
Version: 0.18.0
GitCommit: fec3683

  • libveinmind 版本:
  • 问脉镜像版本: last
  • 代码版本:

docker info :
Docker Root Dir: /home/docker-data
Debug Mode: false
补充说明

GitHub Actions运行错误

Github Actions运行错误
- name: Run veinmind-tools to scan image uses: chaitin/veinmind-action@main with: scan-action: scan-host image-ref: '${{ env.ECR_REGISTRY }}/${{ env.APP_NAME }}:latest-release'

Snipaste_2023-01-31_12-40-23

veinmind-iac_linux_amd64 scan iac 扫描报错 ERRO[0000] un support iac type

Bug 具体描述
veinmind-iac_linux_amd64 scan iac 扫描代码项目报错 ERRO[0000] un support iac type
复现步骤
/veinmind-iac_linux_amd64 scan iac cmn_promotion -f json project

相关截图
image

补充说明
镜像代码project 存在多种形式文件时报错。无法指定输出json或html文件。

数组越界 veinmind-escape工具

Bug 具体描述

复现步骤
docker run --rm --mount 'type=bind,source=/,target=/host,readonly,bind-propagation=rslave' --privileged veinmind-escape scan container xxxxxxx

相关截图
image

环境(空项可以不填)

  • Docker 版本: Docker version 26.1.3, build b72abbb
  • libveinmind 版本:最新版
  • 问脉镜像版本:最新版
  • 代码版本:

[需求]增加支持docker自定义目录

背景

由于/目录磁盘有限,磁盘上挂载/home下,docker 目录非默认/var/lib/docker,系统能够支持自定义目录

信息

Docker Root Dir: /home/docker_data
Debug Mode: false

veinmind-unsafe-mount 无法扫描全部容器

Bug 具体描述
└─# ./veinmind-unsafe-mount scan container
INFO[0000] start scan container unsafe mount: 00b4f49c139b2798ab8af43e9cc45ebd7407ef030be4fa54f806d6d7e247b923
Error: container: container not running, can't get oci spec
Usage:
scan container [flags]

Flags:
--containerd[=true] specify "containerd" as the mode in use
--containerd-config string flag "--config" or "-c" specified to containerd command
--containerd-root string flag "--root" specified to the containerd command
--containerd-unique-desc string unique descriptor of the containerd daemon
--docker[=true] specify "docker" as the mode in use
--docker-config-file string flag "--config-file" specified to the dockerd command
--docker-data-root string flag "--data-root" specified to the dockerd command
--docker-unique-desc string unique descriptor of the docker daemon
-f, --format , cli/json/html, support multiple with , split (default "cli")
-h, --help help for container
--host stringArray the URL of host communication file
--id whether fully qualified ID is specified
--in-cluster string flag "--in-cluster" specified in-cluster
--kube-config-bytes string flag "--kube-config-bytes" specified kube config bytes
--kube-config-path string flag "--kube-config-path" specified kube config
--kubernetes[=true] specify "kubernetes" as the mode in use
-m, --mode string select mode to retrieve root object (default "docker")
--remote[=true] specify "remote" as the mode in use
--remote-root string remote manager system data root
--tarball[=true] specify "tarball" as the mode in use
--tarball-root string tarball manager system data root
-v, --verbose show detail info at cli

复现步骤

相关截图

环境(空项可以不填)

  • Docker 版本: Docker version 20.10.25+dfsg1, build b82b9f3
  • libveinmind 版本:最新
  • 问脉镜像版本:最新
  • 代码版本:

补充说明
└─# cat /proc/version
Linux version 6.1.0-kali9-amd64 ([email protected]) (gcc-12 (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40) #1 SMP PREEMPT_DYNAMIC Debian 6.1.27-1kali1 (2023-05-12)

希望有个全插件版本

目前的插件都需要一个个装,命令也是一条一条敲,能否将所有插件整合到主程序runner里,用一条命令扫描所有插件,或者支持用参数来选择插件。
谢谢

debain系统的系统用户弱密码检测不出来

/opt/veinmind-tools/veinmind-weakpass/artifacts/linux-amd64/veinmind-weakpass_linux_amd64 scan 192.168.1.94:443/library/test_weakpass:0.1
INFO[0002] Start Scan Image SSH Weakpass: 192.168.1.94:443/library/test_weakpass:0.1

============================================================================================

| Scan Total: 1 |
| Spend Time: 2.159982615s |
| Weakpass Image Total: 0 |
| Weakpass Total: 0 |
+----------------------------------------------------------------------------------------------+

============================================================================================

cat /etc/shadow

root::19139:0:99999:7:::
daemon:
:19139:0:99999:7:::
bin::19139:0:99999:7:::
sys:
:19139:0:99999:7:::
sync::19139:0:99999:7:::
games:
:19139:0:99999:7:::
man::19139:0:99999:7:::
lp:
:19139:0:99999:7:::
mail::19139:0:99999:7:::
news:
:19139:0:99999:7:::
uucp::19139:0:99999:7:::
proxy:
:19139:0:99999:7:::
www-data::19139:0:99999:7:::
backup:
:19139:0:99999:7:::
list::19139:0:99999:7:::
irc:
:19139:0:99999:7:::
gnats::19139:0:99999:7:::
nobody:
:19139:0:99999:7:::
_apt:*:19139:0:99999:7:::
nginx:!:19140:0:99999:7:::
test:$y$j9T$c/zxurpmCyM0ACN53Rsnl.$/a3a7ZXTmnZgaIFeUMB21pECYdoU.y.UJQlAULHs9/7:19191:0:99999:7:::

test用户的密码是123456

ModuleNotFoundError: No module named 'report'

Bug 具体描述
Traceback (most recent call last):
File "scan.py", line 14, in
from report import *
ModuleNotFoundError: No module named 'report'

复现步骤

  1. 进入veinmind-backdoor
  2. 执行 pip install -r requirements.txt 成功
  3. python3 scan.py scan-images 192.168.1.94:443/library/av:0.5 报错
  4. See error
    Traceback (most recent call last):
    File "scan.py", line 14, in
    from report import *
    ModuleNotFoundError: No module named 'report'

相关截图

环境(空项可以不填)

  • Docker 版本:
  • libveinmind 版本:veinmind==1.1.0
  • 问脉镜像版本:
  • 代码版本: master

补充说明

# sh ../scripts/build/build_veinmind_weakpass_amd64.sh 报错

错误如下:

github.com/chaitin/libveinmind/go/pkg/binding

/root/GOPATH/pkg/mod/github.com/chaitin/[email protected]/go/pkg/binding/functions.go:273:3: not enough arguments in call to (_Cfunc_veinmind_DockerNew)
have (_Ctype_ulong)
want (
_Ctype_ulong, _Ctype_ulong)
/root/GOPATH/pkg/mod/github.com/chaitin/[email protected]/go/pkg/binding/functions.go:314:3: not enough arguments in call to (_Cfunc_veinmind_ContainerdNew)
have (_Ctype_ulong)
want (
_Ctype_ulong, _Ctype_ulong)

系统:Ubuntu 20.04.4 LTS \n \l

Test

Bug 具体描述

复现步骤

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

相关截图

环境(空项可以不填)

  • Docker 版本:
  • libveinmind 版本:
  • 问脉镜像版本:
  • 代码版本:

补充说明

make plugin LANG=go NAME=test PUB=no

Bug 具体描述

make plugin.init Language=go Name=test Pub=no

make: *** No rule to make target 'plugin.init'. Stop.

补充说明
没有同步修改,makefile中使用的LANG、NAME、PUB参数

asset扫描的输出文件问题

https://github.com/chaitin/veinmind-tools/blob/master/plugins/go/veinmind-asset/utils/report.go#L77

输出文件固定为当前目录的report.json文件

func OutputJSON(res []model.ScanImageResult) error {
	var jsonFile *os.File
	var name = "report.json"
        // ...
}

通过平行容器扫描无法得到输出文件

docker run --rm -it --mount 'type=bind,source=/,target=/host,readonly,bind-propagation=rslave' veinmind/veinmind-asset scan 33f2d4bf4fa9 -f json

应该加一个参数

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.