Nihon Vasserman
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # DevSecOps Lab 5 Ilya Kolomin i.kolomin@innopolis.university Kirill Ivanov k.ivanov@innopolis.university Anatoliy Baskakov a.baskakov@innopolis.university Team number 4, **Webgoat app** ## Task 1 - Theory 1. Explain: * what is DAST? * Dynamic application security testing. Unlike SAST, which is performed on the source code, DAST is performed on a running application. * How does dynamic security testing work? * Multiple approaches are used to try to cause error within a running application. For example, incorrect data is passed to a running app, e.g. an SQL-injection. * What are the advantages of the DAST methodology? * It can find issues which cannot be deduced from the source code. For example, misconfiguration, authentication problems. * Are there any downsides to the DAST methodology? * DAST will not find vulnerabilities or problem in code which unless that chunk of code is run during while application is being tested. 2. List and explain the main criteria when choosing a DAST tool. * ***Coverage***: A DAST tool should cover all use cases of the app. The more vulnerabilities a tool can find the better, however, if a tool meets the requirements for you apps, this stops being the main criteria * ***False results rate***: We expect a tool to have a low false positives (otherwise reports will be ignored) and false negatives rate. * ***Report utilities***: It should generate detailed reports. * ***Support***: A DAST tool should be actively maintained and have good integration with other tools * ***Efficiency***: How fast a scan is performed 4. According to the “Shift Everywhere” paradigm, Security tools in CI/CD should be used where they can bring maximum benefit. Based on this, give and explain at what stage(s) of the development process dynamic analysis can be introduced. * DAST tools are introduced to the "Right" stage of the development process, as opposed to SAST tools which are usually run to the "Left". 5. What is Fuzzing? What is/are the key(s) difference between Fuzzing and common DAST? * Fuzzing is a vulnerability and coding errors detceting method. It sends lots of random inputs in attempt to cause errors or crashes. In such case, fuzzers also may help to find the root cause. * While DAST is about elaborate analyzis and search, fuzzing is a low-effort approach 6. List and describe the different type of Fuzzers you know * There are two different types of fuzzers * ***Behaviour-based***: given some kind of specification on how an app should work, it randomly probes different inputs to see that the app actually does what is expected. There is a close resemblance with property-based testing. * ***Coverage-based***: an attempt to cover as much cases as possible. Instead analyzing expected behaviour, we try to cover a wide range of inputs, and, should an app crash on any, there is a high chance of an issue present. ## Task 2 - Deploy the vulnerable web app First we build an app with Maven, then we create an image with the app and finally we deploy it to our cluster. All of this is accomplished with the following three *gitlab-ci* jobs: ```yaml build-maven: stage: build image: maven:latest script: - mvn package -DskipTests=true artifacts: paths: - target build-image: stage: build image: docker:latest needs: [build-maven] before_script: - docker login -u securelabs -p "$docker_hub_access_token" docker.io script: - docker build --pull -t "securelabs/ssd:lab5" . - docker push "securelabs/ssd:lab5" kube_cluster: stage: deploy needs: [build-image] image: name: alpine/helm:3.10.2 entrypoint: [''] variables: KUBECONFIG: $CI_PROJECT_DIR/kube_config script: - echo "$KUBE_CONFIG" > kube_config - helm package helm - helm upgrade helm helm-* --install ``` Note: 'target' directory, created as the result of *build-maven* job, was too large, so it was necessary to increase the default artifact size When ssh-ing to the cluster: ![](https://i.imgur.com/tA805Ap.png) ## Task 3 - Dynamic Analysis with StackHawk 1. Here is our configuation file for the hawk scan ```yaml= # -- stackhawk configuration for WebGoat test -- app: # -- An applicationId obtained from the StackHawk platform. -- applicationId: d82a19b5-51b4-4f56-bccb-c982067386df # (required) # -- The environment for the applicationId defined in the StackHawk platform. -- env: Test # (required) # -- The url of your application to scan -- host: http://${WEBGOAT_ADDRESS}:8080 # (required) excludePaths: - "/WebGoat/logout" sessionTokens: - JSESSIONID openApiConf: filePath: api-docs.json # -- Customized Configuration for GraphQL/SOAP/OpenAPI, add here -- autoPolicy: true autoInputVectors: true # Configuration Docs: https://docs.stackhawk.com/hawkscan/configuration/ # -- If Authenticated Scanning is needed, add here -- # Authenticated Scanning Docs: https://docs.stackhawk.com/hawkscan/authenticated-scanning.html # Authenticated Scanning Repo: https://github.com/kaakaww/scan-configuration/tree/main/Authentication # -- Help Section -- # Docs: https://docs.stackhawk.com/ # Contact Support: support@stackhawk.com authentication: # Paths that HawkScan checks to see if it is still logged in during the scan loggedInIndicator: "\\QLogout\\E" loggedOutIndicator: "\\QSign in\\E" # Auth(N) HTTP Form usernamePassword: type: FORM loginPagePath: /WebGoat/login # Your login form path loginPath: /WebGoat/login # Your login form path usernameField: username # Field name for the account username/email passwordField: password # Field name for the password scanUsername: ${ZAP_AUTH_PASSWORD} # Inject variable at runtime or place your username here scanPassword: ${ZAP_AUTH_USERNAME} # Inject variable at runtime or place your password here cookieAuthorization: cookieNames: - JSESSIONID # (REQUIRED) Add your Auth(Z) here. Either Cookie or Token # #A path that can only be seen when successfully logged in. HawkScan will check this path to see if log in was successfull testPath: path: "/WebGoat/start.mvc" fail: ".*302.*" # if redirect detected then fail requestMethod: GET hawk: spider: ajax: true ajaxBrowser: CHROME seedPaths: ["/WebGoat/start.mvc#lesson/WebGoatIntroduction.lesson", "/WebGoat/start.mvc"] ``` 2. We use form-based authentication, which could be seen on 34-41 lines. 3. We decided to exclude the `/WebGoat/logout` path in order to stay logged in for the entire scan. Moreover, because of poor performance of built-in crawler, we decided to generate and provide OpenAPI file for this scan. Now the scanner considers much more paths and do not have to re-login after each test on `/WebGoat/logout` page, which does not provide any interesting results for us. Brief result: ![](https://i.imgur.com/GVluj6D.png) ## Task 4 - Dynamic Analysis with ZAP 1. Integrate ZAP Scanner in your pipeline to perform a baseline scan against your application. To launch the scan we use `ictu/zap2docker-weekly`. Job for launching is ```yaml= zap-full: stage: test allow_failure: true image: name: ictu/zap2docker-weekly entrypoint: [""] artifacts: name: zap-full-scan-report paths: - "${ZAP_REPORT_FOLDER}" when: always script: - mkdir ${ZAP_REPORT_FOLDER} - > /zap/zap-full-scan.py -j -a -m 20 -t http://${WEBGOAT_ADDRESS}/WebGoat --hook=/zap/auth_hook.py -r ${ZAP_REPORT_FOLDER_ARG}/webgoat-zap-report-$(date -Iseconds)-full.html -J ${ZAP_REPORT_FOLDER_ARG}/webgoat-zap-report-$(date -Iseconds)-full.json -z "auth.password="${ZAP_AUTH_PASSWORD}" auth.username="${ZAP_AUTH_USERNAME}" auth.password_field=\"exampleInputPassword1\" auth.username_field=\"exampleInputEmail1\" auth.submit_field=\"/html/body/section/section/section/form/button\" auth.loginurl=http://${WEBGOAT_ADDRESS}/WebGoat/login" ``` 2. Integrate ZAP Scanner in your pipeline to perform an authenticated full scan of your application. You can already see parameters for authentication (starting with `auth.`) in the previous step. Authentication is performed successfully, as you can see here: ![](https://i.imgur.com/s1mMQpy.png) 3. Modify the last scan to use a specific context that you’ll detail. We have installed ZAP Desktop and created a context for later use in CI ![](https://i.imgur.com/pFOYHed.png) Also we've manually added exclusion of `logout` just in case. Then we've exported the context file, added to repo, and included in scan process. ![](https://i.imgur.com/8byQbf5.png) 4. Change the scan method to run an API scan using one of the following API method(REST/OpenAPI/Swagger, SOAP). Analyse the new results and share your understandings. ```yaml= zap-api: stage: test allow_failure: true image: name: ictu/zap2docker-weekly entrypoint: [""] artifacts: name: zap-api-scan-report paths: - "${ZAP_REPORT_FOLDER}" when: always script: - mkdir ${ZAP_REPORT_FOLDER} - > /zap/zap-api-scan.py -j -a -m 20 -t http://${WEBGOAT_ADDRESS}/WebGoat/v3/api-docs -f openapi --hook=/zap/auth_hook.py -r ${ZAP_REPORT_FOLDER_ARG}/webgoat-zap-report-$(date -Iseconds)-api.html -J ${ZAP_REPORT_FOLDER_ARG}/webgoat-zap-report-$(date -Iseconds)-api.json -z "auth.password="${ZAP_AUTH_PASSWORD}" auth.username="${ZAP_AUTH_USERNAME}" auth.password_field=\"exampleInputPassword1\" auth.username_field=\"exampleInputEmail1\" auth.submit_field=\"/html/body/section/section/section/form/button\" auth.loginurl=http://${WEBGOAT_ADDRESS}/WebGoat/login" ``` It finds significantly more URLs to scan and vulnerabilities, since apparently it cannot find the needed endpoints by itself/by crawling. Probably it happens because it does not have a good API. Without provided API definition: ![bad](https://i.imgur.com/6SLxEaO.png) With: ![good](https://i.imgur.com/vSdZ0xK.png) Results: ![](https://i.imgur.com/mtrqAYg.png) ## Task 5 - Tools Comparison 1. Provide a comparative analysis of the results obtained in task 3 and task 4 based on the following criterias: * Amount of vulnerabilities * Zap found significantly more vulnerabilities compared to the hawk (~3000 vs ~100). However, most zap's issues are related to returning error code (~2800), which hawk just do not report. What is more important, zap found more attack sources (source code disclosure, for instance) * ![](https://i.imgur.com/QgElPWZ.png) * Also, it found more compromised API end-points for different issues (31 vs 12 for SQL injection, for instance) * Integrations * Both tools perform well with integrating into GitLab CI and provide convinient docker image with guide for configuring. * Reporting * Both tools provide good reporting with detailed evidence. However, hawk also shows useful information on the issue, including description, and prevention mechanism. * ![](https://i.imgur.com/OGn7CXG.jpg) * Scan speed * 7 minutes (zap) vs 3 minutes (hawk) * Scan quality * As mentioned earlier, zap considers more vulnarabilities and have better tests, that helps us to find more insecure end-points. * Authentication * Form based authentication is easily configured on both tools. * However, hawk provides more control over the logged state by default via mandatory specifying checks and session cookie token. * License * Both tools are free for non-commerical use. 2. Based on your comparison, which tool are you more eager to adopt in your environment? Explain why? Despite the lowered speed and unpleasant report, we believe, that Zap is still could be considred as preferrable tool for DAST, because of its scan quality.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully