filecoin-project / lotus

Reference implementation of the Filecoin protocol, written in Go
https://lotus.filecoin.io/
Other
2.85k stars 1.27k forks source link

[BUG] Trivy found critical vulnerabilities that blocks my pipeline from building #6383

Closed giovannirco closed 2 years ago

giovannirco commented 3 years ago

Trivy fails build from v1.9.0 tag I run Trivy after every new Dockerfile build as part of my CI. I have been working on setting up a Lotus node and created a Dockerfile to build it following the docs, cloned v1.9.0 tag and built successfully. I ran some tests directly on k8s and its working fine but Trivy reports some critical vulnerabilities which blocks my deploy pipeline. I can of course override this and keep going and in fact I will while still in dev env but I would like to automate this pipeline and deploy to production and I can't do this with trivy reporting critical vulns

lotus/lotuspond/front/package-lock.json
=======================================
Total: 4 (CRITICAL: 4)

+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
|   LIBRARY    | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION |                 TITLE                 |
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+
| eslint-utils | CVE-2019-15657   | CRITICAL | 1.4.0             | 1.4.1         | Arbitrary Code Execution              |
|              |                  |          |                   |               | in eslint-utils                       |
|              |                  |          |                   |               | -->avd.aquasec.com/nvd/cve-2019-15657 |
+--------------+------------------+          +-------------------+---------------+---------------------------------------+
| handlebars   | CVE-2019-19919   |          | 4.1.2             | 4.3.0         | nodejs-handlebars: prototype          |
|              |                  |          |                   |               | pollution leading to remote code      |
|              |                  |          |                   |               | execution via crafted payloads        |
|              |                  |          |                   |               | -->avd.aquasec.com/nvd/cve-2019-19919 |
+              +------------------+          +                   +---------------+---------------------------------------+
|              | CVE-2021-23369   |          |                   | 4.7.7         | nodejs-handlebars: Remote             |
|              |                  |          |                   |               | code execution when compiling         |
|              |                  |          |                   |               | untrusted compile templates           |
|              |                  |          |                   |               | with strict:true option...            |
|              |                  |          |                   |               | -->avd.aquasec.com/nvd/cve-2021-23369 |
+--------------+------------------+          +-------------------+---------------+---------------------------------------+
| lodash       | CVE-2019-10744   |          | 4.17.11           | 4.17.12       | nodejs-lodash: prototype              |
|              |                  |          |                   |               | pollution in defaultsDeep function    |
|              |                  |          |                   |               | leading to modifying properties       |
|              |                  |          |                   |               | -->avd.aquasec.com/nvd/cve-2019-10744 |
+--------------+------------------+----------+-------------------+---------------+---------------------------------------+

Version (run lotus version):

To Reproduce Steps to reproduce the behavior:

  1. Build the following Dockerfile:
    
    FROM amazonlinux

ENV VERSION=v1.9.0 \ RUSTFLAGS="-C target-cpu=native -g" \ FFI_BUILD_FROM_SOURCE=1

RUN yum update -y && yum groupinstall "Development Tools" -y \ && yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm; yum install -y git gcc bzr jq pkgconfig clang llvm mesa-libGL-devel opencl-headers ocl-icd ocl-icd-devel hwloc-devel \ && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ && wget -c https://golang.org/dl/go1.16.2.linux-amd64.tar.gz -O - | tar -xz -C /usr/local \ && source $HOME/.cargo/env && export PATH=$PATH:/usr/local/go/bin \ && git clone https://github.com/filecoin-project/lotus.git \ && cd lotus \ && git checkout $VERSION \ && make clean \ && make all \ && make install \ && chmod +x /usr/local/bin/lotus* \ && groupadd --gid 1000 filecoin \ && useradd --uid 1000 --gid filecoin --shell /bin/bash --create-home filecoin \ && chown -R filecoin:filecoin /home/filecoin

2. Run trivy agains this image

**Expected behavior**
Trivy would run and find no vulnerabilities that already have a fix available

**Logs**
I have posted the critical vulnerabilities at the begin which are the ones my pipeline purposedely fails the build
Here are all the vulns trivy found:

lotus/extern/test-vectors/gen/extern/filecoin-ffi/rust/Cargo.lock

Total: 12 (UNKNOWN: 12)

+---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+ | futures-task | RUSTSEC-2020-0060 | UNKNOWN | 0.3.5 | >= 0.3.6 | futures_task::waker may | | | | | | | cause a use-after-free if | | | | | | | used on a type that isn't... | | | | | | | -->rustsec.org/advisories/RUSTSEC-2020-0060 | +---------------+-------------------+ + +--------------------------------+---------------------------------------------+ | futures-util | RUSTSEC-2020-0059 | | | >= 0.3.7 | MutexGuard::map can cause | | | | | | | a data race in safe code | | | | | | | -->rustsec.org/advisories/RUSTSEC-2020-0059 | +---------------+-------------------+ +-------------------+--------------------------------+---------------------------------------------+ | generic-array | RUSTSEC-2020-0146 | | 0.12.3 | >= 0.8.4, < 0.9.0, >= 0.9.1, | arr! macro erases lifetimes | | | | | | < 0.10.0, >= 0.10.1, < 0.11.0, | -->rustsec.org/advisories/RUSTSEC-2020-0146 | | | | | | >= 0.11.2, < 0.12.0, >= | | | | | | | 0.12.4, < 0.13.0, >= 0.13.3 | |

root/.cargo/registry/src/github.com-1ecc6299db9ec823/addr2line-0.14.1/Cargo.lock

Total: 1 (UNKNOWN: 1)

+----------+-------------------+----------+-------------------+------------------------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +----------+-------------------+----------+-------------------+------------------------------+---------------------------------------------+ | smallvec | RUSTSEC-2021-0003 | UNKNOWN | 1.4.1 | >= 0.6.14, < 1.0.0, >= 1.6.1 | Buffer overflow in SmallVec::insert_many | | | | | | | -->rustsec.org/advisories/RUSTSEC-2021-0003 | +----------+-------------------+----------+-------------------+------------------------------+---------------------------------------------+

root/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-2.33.3/Cargo.lock

Total: 1 (UNKNOWN: 1)

+-----------+-------------------+----------+-------------------+---------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +-----------+-------------------+----------+-------------------+---------------+---------------------------------------------+ | yaml-rust | RUSTSEC-2018-0006 | UNKNOWN | 0.3.5 | >= 0.4.1 | Uncontrolled recursion leads | | | | | | | to abort in deserialization | | | | | | | -->rustsec.org/advisories/RUSTSEC-2018-0006 | +-----------+-------------------+----------+-------------------+---------------+---------------------------------------------+

root/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-channel-0.4.4/Cargo.lock

Total: 1 (UNKNOWN: 1)

+----------+-------------------+----------+-------------------+--------------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +----------+-------------------+----------+-------------------+--------------------+---------------------------------------------+ | arc-swap | RUSTSEC-2020-0091 | UNKNOWN | 0.4.7 | >= 1.1.0, >= 0.4.8 | Dangling reference in | | | | | | | access::Map with Constant | | | | | | | -->rustsec.org/advisories/RUSTSEC-2020-0091 | +----------+-------------------+----------+-------------------+--------------------+---------------------------------------------+

root/.cargo/registry/src/github.com-1ecc6299db9ec823/flexi_logger-0.14.8/Cargo.lock

Total: 3 (UNKNOWN: 3)

+----------+-------------------+----------+-------------------+------------------------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +----------+-------------------+----------+-------------------+------------------------------+---------------------------------------------+ | miow | RUSTSEC-2020-0080 | UNKNOWN | 0.2.1 | >= 0.2.2, >= 0.3.6 | miow invalidly assumes the memory | | | | | | | layout of std::net::SocketAddr | | | | | | | -->rustsec.org/advisories/RUSTSEC-2020-0080 | +----------+-------------------+ +-------------------+------------------------------+---------------------------------------------+ | net2 | RUSTSEC-2020-0078 | | 0.2.33 | >= 0.2.36 | net2 invalidly assumes the memory | | | | | | | layout of std::net::SocketAddr | | | | | | | -->rustsec.org/advisories/RUSTSEC-2020-0078 | +----------+-------------------+ +-------------------+------------------------------+---------------------------------------------+ | smallvec | RUSTSEC-2021-0003 | | 1.2.0 | >= 0.6.14, < 1.0.0, >= 1.6.1 | Buffer overflow in SmallVec::insert_many | | | | | | | -->rustsec.org/advisories/RUSTSEC-2021-0003 | +----------+-------------------+----------+-------------------+------------------------------+---------------------------------------------+

root/.cargo/registry/src/github.com-1ecc6299db9ec823/hkdf-0.10.0/Cargo.lock

Total: 1 (UNKNOWN: 1)

+---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+ | generic-array | RUSTSEC-2020-0146 | UNKNOWN | 0.8.3 | >= 0.8.4, < 0.9.0, >= 0.9.1, | arr! macro erases lifetimes | | | | | | < 0.10.0, >= 0.10.1, < 0.11.0, | -->rustsec.org/advisories/RUSTSEC-2020-0146 | | | | | | >= 0.11.2, < 0.12.0, >= | | | | | | | 0.12.4, < 0.13.0, >= 0.13.3 | | +---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+

root/.cargo/registry/src/github.com-1ecc6299db9ec823/itertools-0.8.2/Cargo.lock

Total: 1 (UNKNOWN: 1)

+-----------+-------------------+----------+-------------------+--------------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +-----------+-------------------+----------+-------------------+--------------------+---------------------------------------------+ | rand_core | RUSTSEC-2019-0035 | UNKNOWN | 0.2.2 | >= 0.3.1, >= 0.4.2 | Unaligned memory access | | | | | | | -->rustsec.org/advisories/RUSTSEC-2019-0035 | +-----------+-------------------+----------+-------------------+--------------------+---------------------------------------------+

root/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.8.3/Cargo.lock

Total: 1 (UNKNOWN: 1)

+-----------+-------------------+----------+-------------------+---------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +-----------+-------------------+----------+-------------------+---------------+---------------------------------------------+ | rand_core | RUSTSEC-2021-0023 | UNKNOWN | 0.6.1 | >= 0.6.2 | Incorrect check on buffer | | | | | | | length when seeding RNGs | | | | | | | -->rustsec.org/advisories/RUSTSEC-2021-0023 | +-----------+-------------------+----------+-------------------+---------------+---------------------------------------------+

root/.cargo/registry/src/github.com-1ecc6299db9ec823/semver-parser-0.10.2/Cargo.lock

Total: 1 (UNKNOWN: 1)

+---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+ | generic-array | RUSTSEC-2020-0146 | UNKNOWN | 0.12.3 | >= 0.8.4, < 0.9.0, >= 0.9.1, | arr! macro erases lifetimes | | | | | | < 0.10.0, >= 0.10.1, < 0.11.0, | -->rustsec.org/advisories/RUSTSEC-2020-0146 | | | | | | >= 0.11.2, < 0.12.0, >= | | | | | | | 0.12.4, < 0.13.0, >= 0.13.3 | | +---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+

root/.cargo/registry/src/github.com-1ecc6299db9ec823/sha2-0.8.2/Cargo.lock

Total: 1 (UNKNOWN: 1)

+---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+ | generic-array | RUSTSEC-2020-0146 | UNKNOWN | 0.12.3 | >= 0.8.4, < 0.9.0, >= 0.9.1, | arr! macro erases lifetimes | | | | | | < 0.10.0, >= 0.10.1, < 0.11.0, | -->rustsec.org/advisories/RUSTSEC-2020-0146 | | | | | | >= 0.11.2, < 0.12.0, >= | | | | | | | 0.12.4, < 0.13.0, >= 0.13.3 | | +---------------+-------------------+----------+-------------------+--------------------------------+---------------------------------------------+

lotus/lotuspond/front/package-lock.json

Total: 25 (MEDIUM: 25)

+----------------------+---------------------+----------+-------------------+--------------------------------+----------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +----------------------+---------------------+----------+-------------------+--------------------------------+----------------------------------------------+ | acorn | GHSA-6chw-6frg-f759 | MEDIUM | 6.2.1 | 5.7.4, 7.1.1, 6.4.1 | Regular Expression Denial | | | | | | | of Service in Acorn | | | | | | | -->github.com/advisories/GHSA-6chw-6frg-f759 |

root/go/pkg/mod/github.com/apache/thrift@v0.13.0/lib/js/package-lock.json

Total: 2 (MEDIUM: 2)

+----------+---------------------+----------+-------------------+---------------+----------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +----------+---------------------+----------+-------------------+---------------+----------------------------------------------+ | minimist | CVE-2020-7598 | MEDIUM | 0.0.8 | 1.2.3, 0.2.1 | nodejs-minimist: prototype | | | | | | | pollution allows adding | | | | | | | or modifying properties of | | | | | | | Object.prototype using a... | | | | | | | -->avd.aquasec.com/nvd/cve-2020-7598 |

root/go/pkg/mod/github.com/apache/thrift@v0.13.0/lib/ts/package-lock.json

Total: 2 (MEDIUM: 2)

+----------+---------------------+----------+-------------------+---------------+----------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +----------+---------------------+----------+-------------------+---------------+----------------------------------------------+ | minimist | CVE-2020-7598 | MEDIUM | 0.0.8 | 1.2.3, 0.2.1 | nodejs-minimist: prototype | | | | | | | pollution allows adding | | | | | | | or modifying properties of | | | | | | | Object.prototype using a... | | | | | | | -->avd.aquasec.com/nvd/cve-2020-7598 |

root/go/pkg/mod/github.com/apache/thrift@v0.13.0/package-lock.json

Total: 1 (MEDIUM: 1)

+---------+------------------+----------+-------------------+---------------+---------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +---------+------------------+----------+-------------------+---------------+---------------------------------------+ | ws | CVE-2021-32640 | MEDIUM | 5.2.2 | 6.2.2, 7.4.6 | nodejs-ws: Specially crafted value | | | | | | | of the Sec-Websocket-Protocol | | | | | | | header can be used to... | | | | | | | -->avd.aquasec.com/nvd/cve-2021-32640 | +---------+------------------+----------+-------------------+---------------+---------------------------------------+

root/go/pkg/mod/github.com/filecoin-project/go-fil-markets@v1.2.5/package-lock.json

Total: 1 (MEDIUM: 1)

+---------+------------------+----------+-------------------+---------------+---------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +---------+------------------+----------+-------------------+---------------+---------------------------------------+ | ws | CVE-2021-32640 | MEDIUM | 6.2.1 | 6.2.2, 7.4.6 | nodejs-ws: Specially crafted value | | | | | | | of the Sec-Websocket-Protocol | | | | | | | header can be used to... | | | | | | | -->avd.aquasec.com/nvd/cve-2021-32640 | +---------+------------------+----------+-------------------+---------------+---------------------------------------+

lotus/lotuspond/front/package-lock.json

Total: 22 (HIGH: 22)

+----------------------+---------------------+----------+-------------------+---------------------+----------------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +----------------------+---------------------+----------+-------------------+---------------------+----------------------------------------------+ | dot-prop | CVE-2020-8116 | HIGH | 4.2.0 | 5.1.1, 4.2.1 | nodejs-dot-prop: prototype pollution | | | | | | | -->avd.aquasec.com/nvd/cve-2020-8116 | +----------------------+---------------------+ +-------------------+---------------------+----------------------------------------------+ | elliptic | CVE-2020-13822 | | 6.5.0 | 6.5.3 | nodejs-elliptic: improper encoding | | | | | | | checks allows a certain degree | | | | | | | of signature malleability in... | | | | | | | -->avd.aquasec.com/nvd/cve-2020-13822 | +----------------------+---------------------+ +-------------------+---------------------+----------------------------------------------+ | handlebars | GHSA-2cf5-4w76-r9qv | | 4.1.2 | 4.5.2, 3.0.8 | Arbitrary Code Execution in handlebars | | | | | | | -->github.com/advisories/GHSA-2cf5-4w76-r9qv |

root/go/pkg/mod/github.com/apache/thrift@v0.13.0/lib/js/package-lock.json

Total: 2 (HIGH: 2)

+------------+------------------+----------+-------------------+---------------+---------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +------------+------------------+----------+-------------------+---------------+---------------------------------------+ | underscore | CVE-2021-23358 | HIGH | 1.6.0 | 1.12.1 | nodejs-underscore: Arbitrary code | | | | | | | execution via the template function | | | | | | | -->avd.aquasec.com/nvd/cve-2021-23358 |

root/go/pkg/mod/github.com/apache/thrift@v0.13.0/lib/ts/package-lock.json

Total: 2 (HIGH: 2)

+------------+------------------+----------+-------------------+---------------+---------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +------------+------------------+----------+-------------------+---------------+---------------------------------------+ | underscore | CVE-2021-23358 | HIGH | 1.6.0 | 1.12.1 | nodejs-underscore: Arbitrary code | | | | | | | execution via the template function | | | | | | | -->avd.aquasec.com/nvd/cve-2021-23358 |

root/go/pkg/mod/github.com/libp2p/go-mplex@v0.2.0/interop/js/package-lock.json

Total: 1 (HIGH: 1)

+---------+------------------+----------+-------------------+---------------+---------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +---------+------------------+----------+-------------------+---------------+---------------------------------------+ | lodash | CVE-2021-23337 | HIGH | 4.17.19 | 4.17.21 | nodejs-lodash: command | | | | | | | injection via template | | | | | | | -->avd.aquasec.com/nvd/cve-2021-23337 | +---------+------------------+----------+-------------------+---------------+---------------------------------------+

lotus/lotuspond/front/package-lock.json

Total: 4 (CRITICAL: 4)

+--------------+------------------+----------+-------------------+---------------+---------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +--------------+------------------+----------+-------------------+---------------+---------------------------------------+ | eslint-utils | CVE-2019-15657 | CRITICAL | 1.4.0 | 1.4.1 | Arbitrary Code Execution | | | | | | | in eslint-utils | | | | | | | -->avd.aquasec.com/nvd/cve-2019-15657 | +--------------+------------------+ +-------------------+---------------+---------------------------------------+ | handlebars | CVE-2019-19919 | | 4.1.2 | 4.3.0 | nodejs-handlebars: prototype | | | | | | | pollution leading to remote code | | | | | | | execution via crafted payloads | | | | | | | -->avd.aquasec.com/nvd/cve-2019-19919 |

Additional context I tried to find these packages/libraries on the code to change the version but I don't really know what I am doing so I would like to hear from others how I can fix this.

magik6k commented 3 years ago

This is in lotus-pond, which is just a dev-oriented UI for quickly spawning small devnets, mostly used for manually testing things related to network updates.

Just updating dependencies in lotus/lotuspond/front should be enough

Reiers commented 2 years ago

Closing lotus issue ticket since it has been answered.