
หลังจากที่เขียนเรื่อง docker scan เสร็จแล้ว ก็ยังนั่งเล่นเพิ่มเติมอีกนิดหน่อย เพราะว่ายังมีข้อสงสัยที่ยังหาเหตุผลและคำตอบไม่ได้ 
ประเด็นแรก docker scan จะตรวจสอบ application ให้ด้วยไหม
ถ้าลองนั่งเล่นดู จะสังเกตุได้ว่าวิธีที่ docker scan ทำก็คือจะเข้าไปกวาดดูใน container image ดูว่ามีไฟล์อะไรอยู่บ้าง แล้วนำไปเปรียบเทียบกับฐานข้อมูลที่ตัวเองมีอยู่ สิ่งที่สงสัยคือ Snyk ที่ docker scan ใช้เป็นเครื่องมือในการหาช่องโหว่จะรู้จักหรือตรวจสอบ application อื่น ๆ ที่เพิ่มเติมจาก base image ที่เป็น OS ด้วยไหม
Damn Vulnerable Web Application (DVWA) น่าจะเป็นตัวทดสอบที่ดี เป็นที่รู้จักในวงกว้าง DVWA เป็น web application ที่ถูกสร้างให้มีช่องโหว่อยู่มากมาย ใช้เพื่อการเรียนรู้ด้าน Web Application Security ถ้า docker scan ทราบช่องโหว่ของ DVWA ได้ จะได้ทดสอบในมุมอื่น ๆ ต่อไป จึงทดสอบด้วย container image ที่  vulnerables/web-dvwa ใน Docker Hub
> docker scan vulnerables/web-dvwa --json --group-issues
คำตอบที่ได้ก็คือ ผลการ scan ไม่รู้ข้อมูลของ DVWA เลย พบแต่ช่องโหว่ของไฟล์ที่ base image ที่เป็น OS สามารถดูผลทดสอบได้ที่นี่ครับ
ประเด็นที่ 2 เจอ option --file
พบว่า เมื่อเปรียบเทียบการใช้ --file และ ไม่ใช้ --file ผลของการรายงานช่องโหว่ไม่ต่างกัน เพราะว่าเป็นรายงานที่ได้จากข้อมูลใน Container Image แต่สิ่งที่ต่างกันจะอยู่ในช่วงท้ายของรายงาน พบว่าการใส่ --file มีคำแนะนำเพิ่มเติมถ้าในกรณีที่ base image ที่ใช้อยู่มีช่องโหว่ จากตัวอย่างในช่วงท้ายรายงานจะแนะนำให้ใช้ base image alpine:3 ซึ่งไม่มีรายงานช่องโหว่ แทนตัวเดิมที่ใช้ alpine:3.11.0
> docker scan -f .\Dockerfile ws-fac
Testing ws-fac...
✗ Low severity vulnerability found in openssl/libcrypto1.1
  Description: Inadequate Encryption Strength
  Info: https://snyk.io/vuln/SNYK-ALPINE311-OPENSSL-1075739
  Introduced through: openssl/libcrypto1.1@1.1.1d-r2, openssl/libssl1.1@1.1.1d-r2, apk-tools/apk-tools@2.10.4-r3, libtls-standalone/libtls-standalone@2.9.1-r0
  From: openssl/libcrypto1.1@1.1.1d-r2
  From: openssl/libssl1.1@1.1.1d-r2 > openssl/libcrypto1.1@1.1.1d-r2
  From: apk-tools/apk-tools@2.10.4-r3 > openssl/libcrypto1.1@1.1.1d-r2
  and 4 more...
  Image layer: Introduced by your base image (alpine:3.11.0)
  Fixed in: 1.1.1j-r0
[...]
✗ High severity vulnerability found in apk-tools/apk-tools
  Description: Out-of-bounds Read
  Info: https://snyk.io/vuln/SNYK-ALPINE311-APKTOOLS-1246343
  Introduced through: apk-tools/apk-tools@2.10.4-r3
  Image layer: Introduced by your base image (alpine:3.11.0)
  Fixed in: 2.10.6-r0
Organization:      damrongsak
Package manager:   apk
Target file:       .\Dockerfile
Project name:      docker-image|ws-fac
Docker image:      ws-fac
Platform:          linux/amd64
Base image:        alpine:3.11.0
Licenses:          enabled
Tested 14 dependencies for known issues, found 11 issues.
Base Image     Vulnerabilities  Severity
alpine:3.11.0  11               5 high, 5 medium, 1 low
Recommendations for base image upgrade:
Minor upgrades
Base Image  Vulnerabilities  Severity
alpine:3    0                0 high, 0 medium, 0 low
ผลรายงานในกรณีที่ไม่ใส่ --file เพื่อเปรียบเทียบกัน
> docker scan  ws-fac
Testing ws-fac...
✗ Low severity vulnerability found in openssl/libcrypto1.1
  Description: Inadequate Encryption Strength
  Info: https://snyk.io/vuln/SNYK-ALPINE311-OPENSSL-1075739
  Introduced through: openssl/libcrypto1.1@1.1.1d-r2, openssl/libssl1.1@1.1.1d-r2, apk-tools/apk-tools@2.10.4-r3, libtls-standalone/libtls-standalone@2.9.1-r0
  From: openssl/libcrypto1.1@1.1.1d-r2
  From: openssl/libssl1.1@1.1.1d-r2 > openssl/libcrypto1.1@1.1.1d-r2
  From: apk-tools/apk-tools@2.10.4-r3 > openssl/libcrypto1.1@1.1.1d-r2
  and 4 more...
  Fixed in: 1.1.1j-r0
[...]
✗ High severity vulnerability found in apk-tools/apk-tools
  Description: Out-of-bounds Read
  Info: https://snyk.io/vuln/SNYK-ALPINE311-APKTOOLS-1246343
  Introduced through: apk-tools/apk-tools@2.10.4-r3
  From: apk-tools/apk-tools@2.10.4-r3
  Fixed in: 2.10.6-r0
Organization:      damrongsak
Package manager:   apk
Project name:      docker-image|ws-fac
Docker image:      ws-fac
Platform:          linux/amd64
Licenses:          enabled
Tested 14 dependencies for known issues, found 11 issues.
 

 
    
Top comments (0)