Running zap scanner from local docker on Windows

760 views
Skip to first unread message

Stan Smith

unread,
Jun 9, 2022, 2:44:04 PM6/9/22
to OWASP ZAP User Group
Hello, I am trying to run zap locally by doing the following:
  1. docker pull owasp/zap2docker-stable:latest
  2. docker run -v C:\Users\ssmith4\git\zap\ -t owasp/zap2docker-stable bash -c "zap.sh -cmd -addonupdate; zap.sh -cmd -autorun /zap/zap.yaml"
I get this error:
Cannot access file: /zap/zap.yaml

Not sure what I'm doing wrong. Any ideas?

My zap.yaml from C:\Users\ssmith4\git\zap\ path has the following:
---
env:
  contexts:
  - name: "Jigsaw Basic"
    urls:
    includePaths:
    excludePaths: []
    sessionManagement:
      method: "http"
      parameters: {}
  parameters:
    failOnError: false
    failOnWarning: true
    progressToStdout: true
  vars: {}
jobs:
- parameters:
    user: "guest"
  requests:
    name: ""
    method: ""
    data: ""
    responseCode: 200
    name: ""
    method: ""
    data: ""
    responseCode: 200
  name: "requestor"
  type: "requestor"
- parameters:
    maxDuration: 0
  name: "passiveScan-wait1"
  type: "passiveScan-wait"

Charles Williams

unread,
Jun 9, 2022, 3:26:33 PM6/9/22
to OWASP ZAP User Group
Might be that you need to mount to /zap/wrk since you're using the packaged scan. It is looking for your YAML file in the Docker image instance as it runs, and since it isn't mounted it can't find it.

Try something like this (might need to mess with backslashes and stuff like that). It mounts your working dir to /zap/wrk and (should!) allow your instance to access your zap.yaml: 
docker run -v C:\Users\ssmith4\git\zap\:\zap\wrk\:rw -t owasp/zap2docker-stable bash -c "zap.sh -cmd -addonupdate; zap.sh -cmd -autorun \zap\wrk\zap.yaml"


Hope this helps!

Stan Smith

unread,
Jun 10, 2022, 7:29:36 AM6/10/22
to OWASP ZAP User Group
That command was pretty close! As you said, messing with backslashes ended up getting to the correct command:

docker run -v C:\Users\ssmith4\git\zap\:/zap/wrk/:rw -t owasp/zap2docker-stable bash -c "zap.sh -cmd -addonupdate; zap.sh -cmd -autorun /zap/wrk/zap.yaml"

Thanks!

Reply all
Reply to author
Forward
0 new messages