Skip to content

Consider adding docker security scanner? #6

Open

Description

@fzipi

We may want to add an action for docker security scanning:

https://github.com/phonito/phonito-scanner-action

Activity

  1. franbuehler commented on Aug 30, 2020

    @franbuehler
    Contributor

    I tried this in my fork and it works. We have vulnerabilities in our images though:

    modsecurity-crs-docker
    https://github.com/franbuehler/modsecurity-crs-docker/runs/1047826260?check_suite_focus=true:

    Scan with Phonito Security
    15s
    ##[error]Docker image contains vulnerabilities
    Found vulnerabilities as of: Sun Aug 30 2020 14:26:14 GMT+0000 (Coordinated Universal Time)
    ┌──────────────────┬─────────┬──────────┬───────────────────┐
    │ CVE ID           │ Product │ Severity │ Installed Version │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2019-1387    │ git     │ HIGH     │ 1:2.20.1          │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2019-1348    │ git     │ LOW      │ 1:2.20.1          │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2019-1353    │ git     │ CRITICAL │ 1:2.20.1          │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2020-5260    │ git     │ HIGH     │ 1:2.20.1          │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2019-1551    │ openssl │ MEDIUM   │ 1.1.1d            │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2018-1000156 │ patch   │ HIGH     │ 2.7.6             │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2018-20969   │ patch   │ HIGH     │ 2.7.6             │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2018-6951    │ patch   │ HIGH     │ 2.7.6             │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2018-6952    │ patch   │ HIGH     │ 2.7.6             │
    ├──────────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2019-20633   │ patch   │ MEDIUM   │ 2.7.6             │
    └──────────────────┴─────────┴──────────┴───────────────────┘
    
    10 vulnerabilities present owasp/modsecurity-crs:3.3-apache.
    View scan details: https://phonito.io/vulnerabilities/b3dhc3AvbW9kc2VjdXJpdHktY3JzOjMuMy1hcGFjaGU=
    ##[error]Docker image contains vulnerabilities
    

    I think a rebuild and push of the underlying owasp/modsecurity-docker image would already help, we have fewer vulnerabilities there:

    modsecurity-docker
    https://github.com/franbuehler/modsecurity-docker/runs/1047876721?check_suite_focus=true

     Scan with Phonito Security
    14s
    [PHONITO] Succesfully scanned image.
    Run phonito/phonito-scanner-action@master
    wget https://phonito-public-artifacts.azureedge.net/scanner/phonito-scanner -O /tmp/phonito-scanner --quiet
    chmod +x /tmp/phonito-scanner
    /tmp/phonito-scanner -i owasp/modsecurity:v2-apache --fail-level HIGH
    Phonito Security scan complete!
    Found vulnerabilities as of: Sun Aug 30 2020 14:58:57 GMT+0000 (Coordinated Universal Time)
    ┌───────────────┬─────────┬──────────┬───────────────────┐
    │ CVE ID        │ Product │ Severity │ Installed Version │
    ├───────────────┼─────────┼──────────┼───────────────────┤
    │ CVE-2019-1551 │ openssl │ MEDIUM   │ 1.1.1d            │
    └───────────────┴─────────┴──────────┴───────────────────┘
    
    1 vulnerabilities present owasp/modsecurity:v2-apache.
    View scan details: https://phonito.io/vulnerabilities/b3dhc3AvbW9kc2VjdXJpdHk6djItYXBhY2hl
    [PHONITO] Succesfully scanned image.
    
    

    Questions:
    Do we want to add a schedule to the "build and push" workflows:

    And do we want to extend the build and push with this security scan?

  2. bittner commented on Aug 30, 2020

    @bittner
    Contributor

    Adding a scheduled scan makes certainly sense. We should then only trigger rebuilding the image when necessary, e.g. when vulnerabilities were found.

  3. fzipi commented on Aug 30, 2020

    @fzipi
    MemberAuthor

    This looks cool @franbuehler ! I think @bittner has a point in just creating a new one only when something is found. Do you need additional help with setting it up?

  4. bittner commented on Aug 31, 2020

    @bittner
    Contributor

    Whatever you can do that brings us forward is super-welcome!

    We, at @vshn, would still need to invest time to verify the 4 main images (owasp/modsecurity:apache, owasp/modsecurity-crs:apache, and owasp/modsecurity:nginx, owasp/modsecurity-crs:nginx) in Production. We still maintain derivatives of our own image based on CRS 3.1, which is somewhat the "mother" of the changes we applied to the current images. I see some work ahead to align the last bits we might have overlooked when taking over our current features.

  5. franbuehler commented on Sep 1, 2020

    @franbuehler
    Contributor

    Thank you @fzipi and @bittner
    Ok, I'll try to implement this (when I find some time).

    And yes, then we should investigate which changes are still missing in our official images and what else needs to be done.

  6. bittner commented on Sep 14, 2020

    @bittner
    Contributor
  7. self-assigned this
    on Dec 15, 2020
  8. MitchellCash commented on Aug 5, 2021

    @MitchellCash

    Relates to coreruleset/modsecurity-docker#43.

    I also just ran a trivy scan against owasp/modsecurity-crs:v3.3.2-nginx and it returned:

    owasp/modsecurity-crs:v3.3.2-nginx (debian 10.10)
    =================================================
    Total: 323 (UNKNOWN: 0, LOW: 215, MEDIUM: 45, HIGH: 55, CRITICAL: 8)

    Now that modsecurity-docker has moved to Alpine it would be nice to see modsecurity-crs-docker also move from Debian to Alpine.

    NGINX maintain both Debian and Alpine images, so hopefully this is not a large increase in maintenance burden as we can still rely on default upstream images.

  9. fzipi commented on Nov 30, 2021

    @fzipi
    MemberAuthor

    @MitchellCash Can you run it again now that we have alpine images? We still need to run this in a pipeline.

  10. MitchellCash commented on Dec 1, 2021

    @MitchellCash

    @fzipi Alpine based image looks good to me on the initial trivy scan (also the image is almost half the size)! Nice work!

    Debian based image

    owasp/modsecurity-crs:3.3.2-nginx (debian 11.1)
    ===============================================
    Total: 232 (UNKNOWN: 0, LOW: 156, MEDIUM: 43, HIGH: 24, CRITICAL: 9)
    

    Alpine based image 🥳

    owasp/modsecurity-crs:3.3.2-nginx-alpine (alpine 3.14.3)
    ========================================================
    Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
    
  11. fzipi commented on Jan 18, 2022

    @fzipi
    MemberAuthor

    Good, this matches my own tests. I don't think we can do too much in the debian image (I've checked a couple criticals, and they are still there :/ ).

  12. fzipi commented on Aug 18, 2026

    @fzipi
    MemberAuthor

    Implemented in #459, which took over the stalled #296.

    Pull requests scan the image they just built and fail on HIGH,CRITICAL findings that have a fix available, so only actionable vulnerabilities block a merge. A daily workflow scans the published ghcr.io images, one scan per image and platform, and reports into code scanning instead of failing.

    It has already earned its keep before merging: it caught CVE-2026-34191, CVE-2026-33630 and CVE-2026-56408 in the alpine images (fixed in #465) and CVE-2026-53615 in the debian ones (#466). Both came from base images shipping package versions the distributions had already patched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions