Security-JAWS#3 Integrate Vuls with OWASP Dependency Check. To enable automatic update of vuls config when the programming language libraries are update.

This slide was used in [Security-JAWS 【第3回】2016年10月28日(金)](https://s-jaws.doorkeeper.jp/events/51939)
2016/10/28 @ Tokyo

![vuls_logo.png](https://qiita-image-store.s3.amazonaws.com/0/22462/01c6d661-8b7f-43f9-c7f8-7d1577205764.png)

---

# Who am I
- Kota Kanbe ([Twitter](https://twitter.com/kotakanbe), [GitHub](https://github.com/kotakanbe), [Facebook] (https://www.facebook.com/kota.kanbe) )
- Programmer @ Future architect, Inc. Japan
- Author of [GitHub Vuls](https://github.com/future-architect/vuls/)
- Owner of [Mohikan Slack](http://qiita.com/kotakanbe@github/items/32cf4eb3de1741af26fb)

---

# Vulnerability Management on AWS

[Amazon Inspector is awesome](http://www.slideshare.net/AmazonWebServices/sec324-new-introducing-amazon-inspector?qid=19a31007-f92e-4bf0-9ad5-a976e8b25b09&v=&b=&from_search=3)
![_SEC324__NEW__Introducing_Amazon_Inspector.png](https://qiita-image-store.s3.amazonaws.com/0/22462/fbb67db2-b8f3-d6b9-26ab-1f4623410551.png)

Inspector can scan only OS packages.
We need to manage vulnerabilities of programming language libraries.
Today, I talk about how to manage it automatically and the way to notify the scan report by slack or E-Mail in Japanese by using Vuls and OWASP Dependency Check.

---

# Vuls (VULnerability Scanner)

- Vulnerability scanner for Linux/FreeBSD, agentless, written in Go
- Not for web vulnerability scanner
- [GitHub Vuls](https://github.com/future-architect/vuls)
- [異常なほど詳しい日本語README](https://github.com/future-architect/vuls/blob/master/README.ja.md)

---

# What's Vuls
- [IPA MyJVN API 活用事例その５](http://jvndb.jvn.jp/apis/)

![vuls.png](https://qiita-image-store.s3.amazonaws.com/0/22462/d25be9c0-255b-37a2-3157-f93b3e8952ab.png)

---

# Buzzed All Over The World
<img width="817" alt="Star_history.png" src="https://qiita-image-store.s3.amazonaws.com/0/22462/6f03ec15-41d7-9fc8-f362-97e2961b30a1.png">

--- 

# Got First Place In GitHub Trending
2016/10/1 All Language
![image002.png](https://qiita-image-store.s3.amazonaws.com/0/22462/281e7713-954f-687c-6ff8-1d9b3055e9b3.png)

---
# Architecture

![vuls-architecture.png](https://qiita-image-store.s3.amazonaws.com/0/22462/ff60362b-3164-f74d-408a-4d6114fde6f1.png)

---

# Features ([日本語](https://github.com/future-architect/vuls/blob/master/README.ja.md#abstract))

- Scan for any vulnerabilities in Linux/FreeBSD Server
    - Supports Ubuntu, Debian, CentOS, Amazon Linux, RHEL, FreeBSD
    - Cloud, on-premise, Docker
- Scan middleware that are not included in OS package management
    - Scan N/W Devices, middleware, programming language libraries and framework for vulnerability
    - Support software registered in [CPE](https://nvd.nist.gov/cpe.cfm) ([日本語](https://www.ipa.go.jp/security/vuln/CPE.html))
- Agentless architecture
    - User is required to only setup one machine that is connected to other target servers via SSH
- Nondestructive testing
- Pre-authorization is not necessary　before scanning on AWS
- Email and Slack notification are both available. (supports Japanese language) 
- Scan result is viewable on accessory software, TUI Viewer terminal or Web UI ([VulsRepo](https://github.com/usiusi360/vulsrepo)).

---

# Usage: Scan vulnerabilities of non-OS packages

[README](https://github.com/future-architect/vuls/blob/master/README.md#usage-scan-vulnerability-of-non-os-package) , [README日本語](https://github.com/future-architect/vuls/blob/master/README.ja.md#usage-scan-vulnerability-of-non-os-package)

```
[servers]

[servers.172-31-4-82]
host         = "172.31.4.82"
user        = "ec2-user"
keyPath     = "/home/username/.ssh/id_rsa"
cpeNames = [
  "cpe:/a:rubyonrails:ruby_on_rails:4.2.1",
]
```

---
# Sample: NVD Vulnerability Database

```
  <entry id="CVE-2016-2098">
    <vuln:vulnerable-software-list>
      ...
      <vuln:product>cpe:/a:rubyonrails:ruby_on_rails:4.2.1</vuln:product>
      ...
    </vuln:vulnerable-software-list>
    <vuln:cve-id>CVE-2016-2098</vuln:cve-id>
    <vuln:cvss>
      <cvss:base_metrics>
        <cvss:score>7.5</cvss:score>
        <cvss:access-vector>NETWORK</cvss:access-vector>
        ...
    </vuln:cvss>
    ...
    <vuln:cwe id="CWE-20"/>
    <vuln:summary>Action Pack in Ruby on Rails before 3.2.22.2, 4.x before 4.1.14.2, and 4.2.x before 4.2.5.2 allows remote attackers to execute arbitrary Ruby code by leveraging an application's unrestricted use of the render method.</vuln:summary>
  </entry> 
```

---
# How to find CPE names of libraries

- [NVD: Search Common Platform Enumerations (CPE)](https://web.nvd.nist.gov/view/cpe/search)
    - It’s such a hassle

- [go-cpe-dictionary](https://github.com/kotakanbe/go-cpe-dictionary) is a good choice for geeks.
    - It’s a hassle

- When you update the libraries, you also have to update the config.toml of Vuls ;)

---
# [OWASP Dependency Check](https://www.owasp.org/index.php/OWASP_Dependency_Check)

- Dependency-Check is a utility that identifies project dependencies 
- checks if there are any known, publicly disclosed, vulnerabilities. 
- Currently Java and .NET are supported; 
- additional experimental support has been added for Ruby, Node.js, Python, and limited support for C/C++ build systems (autoconf and cmake).

---
<img width="775" alt="組み込んだOSSコンポーネントの更新漏れを可視化する「OWASP_Dependency_Check」__2_5_：CodeZine（コードジン）.png" src="https://qiita-image-store.s3.amazonaws.com/0/22462/e25cd43f-a0dc-6042-1f9d-b30556a21b4f.png">

- [組み込んだOSSコンポーネントの更新漏れを可視化する「OWASP Dependency Check」より抜粋](http://codezine.jp/article/detail/9608?p=2)

---
# OWASP Dependency Check Report
- [HTML Report](http://codezine.jp/article/detail/9608?p=4)
- [XML Report](https://gist.github.com/kotakanbe/7de6bab78b726f53efa3b2bf3203807a)

---
# Integrate with OWASP Dependency Check

- [#232](https://github.com/future-architect/vuls/pull/232)
- Execute OWASP Dependency Check with `--format=XML` option.
- Define the xml file path of dependency check in config.toml.

```
[servers.u16]
host     = "127.0.0.1"
port     = "22"
user     = "vuls"
keyPath  = "/path/to/.ssh/id_rsa"
dependencyCheckXMLPath = "/tmp/dependency-check-report.xml"
```

---
# Demo

---
# Benefit Of Integrating Vuls And OWASP Dependency Check

- Automatic Update of Vuls config when the libraries are updated.
- Reporting in Japanese
    - OWASP Dependency Check supports only English
- Reporting by Email or Slack by using Vuls.

--- 

# Tagging To EC2

- [脆弱性スキャナVulsでAmazon EC2をスキャンし脆弱性深刻度をタグ付けする](http://qiita.com/kotakanbe@github/items/4dfe27bd55bbdda27f8a)

---

# What I'm planning to do next

- [Faraday plugin](https://github.com/infobyte/faraday)

---
# Presentation (in Japan)

- ~~7/6-8 [JANOG38](https://www.janog.gr.jp/meeting/janog38/program/secuope.html)~~
- ~~7/27 [July Tech Fest 2016](http://2016.techfesta.jp/speaker.html#S25)~~
- ~~10/5-7 [Security Days Fall 2016](http://www.f2ff.jp/secd/2016/fall/)~~
- ~~10/22  [AVTokyo](http://ja.avtokyo.org/avtokyo2016/event)~~
- ~~10/26 [GREE社内勉強会](http://labs.gree.jp/blog/2016/01/15758/)~~
- 10/28 [Security-JAWS #3](https://s-jaws.doorkeeper.jp/events/51939)
- 11/22 [OSSユーザのための勉強会#16 Vuls](https://www.scsk.jp/event/2016/20161122_2.html)
- 12/1 [Internet Week 2016](https://internetweek.jp/program/d3/d3-1.html)

---
# How To Catchup Vuls

- [Vuls README is awesome](https://github.com/future-architect/vuls)
- VulsMatsuri #1
    - 2016/9/26 about 100 people
    - [Slides@connpass](http://vuls-jp.connpass.com/event/38391/presentation/)
- Links
    - [脆弱性スキャナVuls 関連リンク集](http://qiita.com/usiusi360/items/aeb3cd3630badfacdb4e)
- Join Slack Team

---

# We Are Hiring Hacker And Engineer! 

If you are interested, please contact me ( Twitter: @kotakanbe )

- http://www.future.co.jp/recruit/
- [来たれ、奇人・変人・達人！ってボスが言ってる](https://newspicks.com/news/1766875/body/?ref=user_2187)

---

# Thanks

Give a GitHub Star if you are interested :)