<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Scott Gerlach on Medium]]></title>
        <description><![CDATA[Stories by Scott Gerlach on Medium]]></description>
        <link>https://medium.com/@scott.gerlach?source=rss-74b80228b4b7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*Fr4aSdfFaGBXu458Q8Ymdg.png</url>
            <title>Stories by Scott Gerlach on Medium</title>
            <link>https://medium.com/@scott.gerlach?source=rss-74b80228b4b7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 09:21:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@scott.gerlach/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Application Security Observability]]></title>
            <link>https://medium.com/stackhawk/application-security-observability-f0bbe1085543?source=rss-74b80228b4b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0bbe1085543</guid>
            <category><![CDATA[dast]]></category>
            <category><![CDATA[appsec]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Scott Gerlach]]></dc:creator>
            <pubDate>Sat, 02 May 2020 20:46:07 GMT</pubDate>
            <atom:updated>2020-05-02T21:13:38.927Z</atom:updated>
            <content:encoded><![CDATA[<p>AppSec works best when it is distributed across the engineering team. Bringing visibility to security bugs so all developers can share the fix responsibility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qXk8h9NdFilg_534" /></figure><p>Nobody wants to ship insecure applications. But with application security practices that lag behind frequent deployments (or are just non-existent), apps are shipped to production without ensuring that they are free of security bugs.</p><p>Bring application security visibility to your engineering team by surfacing results from your AppSec scans in Slack.</p><h3>tl;dr</h3><p>Security is shifting left and modern engineering teams are taking control over the security of their applications. Here are the best ways to get going:</p><ul><li><strong>Scan Your Apps.</strong> Use both static and dynamic scanners to catch bugs in dependencies and in the code your team wrote.</li><li><strong>Use Modern Tooling. </strong>Use dev tools, not enterprise security platforms. Find tooling that integrates with your CI/CD tooling and other engineering team workflows.</li><li><strong>Create AppSec Visibility. </strong>Application security works best when distributed across the engineering team. Leverage Slack to surface your application scans to the whole dev team.</li><li><strong>Resist The Urge To Segregate. </strong>So often we want to lock down the information about Application Security bugs to only the Engineering team that owns the app. Make use of the whole talent pool and let people learn from mistakes.</li></ul><h3>Find Application Security Bugs</h3><p>Engineering teams should be focused on preventing two types of security bugs: security bugs they added into the code and security bugs that are pulled in via dependencies. Both types of bugs are easy to introduce. Simple mistakes in the code your team writes can leave your app open to SQL injections, cross site scripting, and more. Or, you may have used a popular open source framework that has an exploitable vulnerability. Even the most seasoned developers will inadvertently introduce these bugs to their apps.</p><p>To find these bugs, you should use both types of application security testing:</p><ul><li><strong>Dynamic Application Security Testing (DAST):</strong> This type of testing runs against a running version of your application, looking for security bugs that an external attacker would be able to find.</li><li><strong>Static Application Security Testing (SAST):</strong> This type of testing analyzes your code base to build a dependency tree and then compares the dependencies against a database of known vulnerabilities. Some options.</li></ul><p>Historically, these types of security tests have been packaged together in complex enterprise security platforms that are built for security teams. As security shifts left, however, a new breed of tooling has been created that allows developers to take ownership over the security of their application. Obvious bias here, but we believe that <a href="http://stackhawk.com/">StackHawk</a> is the tool of choice for dynamic testing. For static testing, some modern options include <a href="http://snyk.io/">Snyk</a>, <a href="https://dependabot.com/">Dependabot</a>, or <a href="https://www.sonarqube.org/">SonarQube</a>.</p><h3>Automate! Don’t Let Bugs Hit Production</h3><p>While learning secure development practices is always a good idea, automated checks for security bugs is the only scalable and consistent way to ensure that these bugs don’t hit production. If you don’t already have it, you should add Dynamic Application Security Testing (testing for bugs in the code you wrote) and Static Application Security Testing (testing for dependency vulnerabilities) into your build pipeline.</p><p>Upon merge, your build pipeline will spin up your application for a dynamic security test while at the same time checking for vulnerabilities in your dependencies. At first, many companies set these as non-blocking steps in their build pipeline prior to configuring blocking criteria.</p><h3>Make Security Scalable with Visibility in Slack</h3><p>Ensuring that your applications are secure can be hard at first. The traditional application security model is broken, with a reliance on stretched-thin security teams that can’t keep up with the speed of deployment. Responsibility for application security is shifting into the engineering team, and tooling and processes that work with the engineering team’s existing workflows is the only way that application security will become part of the engineering org.</p><p>One of the best ways to start on this journey is to push your pipeline application security checks into Slack. This brings visibility to the entire engineering team. When they see a scan with a new critical security bug, they can jump into StackHawk or a similar tool for details on the bug and how to fix it. In our experience, developers care about shipping quality code and will quickly address issues when they hit.</p><p>In StackHawk, developers can see the details of the bug, the request / response payloads, and links to documentation on recommended steps to fix. With this, bugs can be fixed quickly after they are introduced by any engineer on the team. While a developer is still in context of the code they just pushed, the cost of a fix is often quite small. With the Slack integration, your team can check for new bugs once a pipeline scan completes and quickly triage any bugs that are found.</p><p>To learn more about StackHawk + Slack, check out Slack in the <a href="https://slack.com/apps/A0114L5HGP5-stackhawk">App Directory</a> or <a href="https://www.stackhawk.com/blog/slack-integration-announcement/">Slack announcement</a> blog post.</p><figure><img alt="StackHawk Loves Slack" src="https://cdn-images-1.medium.com/max/1024/0*dGXYrw5g6LzJf0e-" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0bbe1085543" width="1" height="1" alt=""><hr><p><a href="https://medium.com/stackhawk/application-security-observability-f0bbe1085543">Application Security Observability</a> was originally published in <a href="https://medium.com/stackhawk">StackHawk</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using StackHawk in GitLab Know Before You Go (Live) — StackHawk]]></title>
            <link>https://medium.com/stackhawk/using-stackhawk-in-gitlab-know-before-you-go-live-stackhawk-ac052a04daee?source=rss-74b80228b4b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac052a04daee</guid>
            <category><![CDATA[dast]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[appsec]]></category>
            <dc:creator><![CDATA[Scott Gerlach]]></dc:creator>
            <pubDate>Tue, 21 Apr 2020 09:06:00 GMT</pubDate>
            <atom:updated>2020-04-21T17:53:02.064Z</atom:updated>
            <content:encoded><![CDATA[<h3>Using StackHawk in GitLab Know Before You Go (Live) — StackHawk</h3><p>The earlier you find application bugs, the cheaper it is to fix them. That’s one of the reasons so many organizations have adopted Test Driven Development (TDD). TDD enables Developers to more accurately identify if the code you are about to commit is going to break and not pass the tests you’ve instrumented in CI/CD. Analogous to the TDD process, we believe in automating application security testing. That’s why we created StackHawk!</p><h3>Check Out How it Works</h3><p>This post demonstrates how to leverage StackHawk to automate testing for AppSec bugs in your CI/CD pipeline. We’ll walk through:</p><ul><li>An Example App, “Vulny Django”, used for testing StackHawk</li><li>How I Dockerized my Django App</li><li>Building and testing my app in GitLab</li><li>Finding application security bugs in the pipeline with StackHawk</li></ul><p><em>Note: StackHawk is a dynamic application security testing (DAST) scanner that actively tests the code that developers write for security bugs</em></p><h3>Example App: Polling with Django + Local StackHawk Scan</h3><p>I took the <a href="https://docs.djangoproject.com/en/3.0/intro/tutorial01/">Django tutorial</a> on making a polls application and modified it into a project I call <a href="https://github.com/stackhawk/vuln_django_play">Vulny Django</a> to test StackHawk. I’m not the best coder, so as I created the app, I wanted to run the tests that we built in with the tutorial alongside the StackHawk DAST scanner. Running StackHawk locally allows me to ensure that I have not introduced any AppSec bugs as I build.</p><p>The StackHawk scanning capability is configured via a <a href="https://docs.stackhawk.com/hawkscan/getting-started.html#configuration">yaml file</a> that describes how to scan your application. In this example app, we have a pretty simple <a href="https://github.com/stackhawk/vuln_django_play/blob/develop/stackhawk.yml">StackHawk config</a> to scan locally, as we mostly have to instrument how to log in to the admin page and a few URLs to exclude. With this configuration, I can easily scan my Polls app and the admin interface from my local laptop using the command:</p><pre>vulny_django_play/ $ docker run -e API_KEY=${HAWK_API_KEY} --rm -v $(pwd):/hawk:rw -it stackhawk/hawkscan:latest</pre><p>This command dynamically scans my running Django app to test it for security issues that can be triaged on the StackHawk platform.</p><h3>Containerizing The Polls App for Testing in Pipeline</h3><p>I have also dockerized my Django project, because why wouldn’t you!? I want to be able to scan my Django project in <a href="https://about.gitlab.com/stages-devops-lifecycle/">GitLab’s awesome DevOps platform</a>. To do that, my application needs to be running somewhere. While I could deploy my app onto a staging site and have HawkScan, the StackHawk scanner, scan it there, I choose the ephemeral route, where everything only lives temporarily while I test it. This allows me to break builds if I find an issue before deploying my app to a place that may be being used for user testing or other things.</p><p>Using docker, I can create a docker network and attach my Django and StackHawk/HawkScan containers to it so they can talk to each other. Doing that looks like this on the command line.</p><pre>/vulny_django_play/ $ docker network create scan_net </pre><pre>/vulny_django_play/ $ docker run --detach -p 8020:8020 --network scan_net --name vuln-django --rm vuln_django:latest </pre><pre>/vulny_django_play/ $ docker run -e API_KEY=${HAWK_API_KEY} -e HOST=http://vuln-django --rm -v $(pwd):/hawk:rw --tty --network scan_net stackhawk/hawkscan:latest</pre><p>With these commands, we are:</p><ol><li>Building the docker virtual network named ‘scan_net’</li><li>Running the Django docker image attached to the scan network that we built (docker build . -t vuln_django:latest)</li><li>Running the Django docker image attached to the scan network that we built (docker build . -t vuln_django:latest)</li><li>Running HawkScan while attaching it to the scan_net and overriding the HOST variable in the stackhawk.yml to point at the docker network name of the Django App</li></ol><p><strong>PSA</strong>: Django will not let you put underscores in a host name like this <a href="http://vuln_django/">http://vuln_django</a> because it’s not RFC compliant. If you do that, you will Google search for a while to try and figure out why your app is not working in the docker network only to find that if you change that to a dash, <a href="http://vuln-django/">http://vuln-django</a>, everything will work fine and you will be embarrassed ( <em>actually that last part might just be me</em>).</p><p>Once this is all set, you’ll have two Docker containers talking to each other over a virtual Docker network. This is a perfect time to start working on our GitLab config, since we can do Docker-In-Docker in GitLab.</p><h3>Go Go Gadget GitLab!</h3><p>GitLab’s DevOps Platform has awesome capabilities. I wanted to wire up my Django project with a platform that could run my tests on PRs when I commit code, or when I want to merge code. GitLab CI/CD made that process pretty easy. They employ a pretty <a href="https://docs.gitlab.com/ee/ci/quick_start/README.html">simple yml config file</a> to instrument what the pipeline should look like and do.</p><p>I chose a few tests to run, like flake8 and the migrations and tests I had written to run in the test phase using the python:3.7-buster image. So here we are installing the python library requirements, running flake8, then pre-populating the DB with info and running the test suite.</p><pre>test:<br>  stage: test<br>  image: python:3.7-buster<br>  script:<br>  # This configures the test stuff<br>  - apt-get update -qy<br>  - apt-get install -y python-dev python-pip<br>  - pip install -r src/requirements.txt<br>  - flake8 vuln_django --max-line-length=127<br>  - cd src<br>  - python manage.py migrate<br>  - python manage.py test</pre><p>This allows me to make sure my code is healthy before I do anything else, like, say…</p><h4>Testing the Build of The Docker Container</h4><p>Now it’s time for me to make sure my docker container will successfully build in CI/CD. Here, I need to tell GitLab Runner how to build my image, which is SUPER easy. I tell it I need the docker image and that I would also like the Docker-in-Docker server to make sure that doesn’t introduce any issues with my build:</p><pre>docker-build:<br>  stage: build<br>  image: docker:19.03.1<br>  services:<br>    - docker:19.03.1-dind<br>  script:<br>   - docker build -t vuln_django:latest .</pre><p>This section is pretty straightforward and is similar to building a docker image on your workstation or laptop. This again is just making sure the image will build so that we can get to the good stuff.</p><h4>Scanning My Dockerized Polls App with StackHawk</h4><p>Now it’s time to scan the dockerized version of my Django app. We know we can scan the application on our workstation in either Virtual Environment or dockerized versions. We know we can make one Docker container talk to another Docker container, so let’s tell the GitLab runner how to do that.</p><ol><li>We’ll need the docker image to build upon</li><li>We’ll need the Docker-in-Docker service</li><li>We’ll build the Docker virtual network</li><li>We have to build the Django container and download the StackHawk/HawkScan container</li><li>We’ll have to set the two Docker images to run on the virtual network</li><li>We’ll use a YML override to tell the StackHawk scanner about a new environment and where to find the running application.</li></ol><p>This section of our .gitlab-ci.yml file looks like this:</p><pre>hawk_scan_execute:<br>  stage: scan<br>  image: docker:19.03.1<br>  services:<br>    - docker:19.03.1-dind<br>  script:<br>    - docker build -t vuln_django:latest .<br>    - docker network create scan_net<br>    - docker pull stackhawk/hawkscan:latest<br>    - docker run --detach -p 8020:8020 --network scan_net --name vuln-django --rm vuln_django:latest<br>    - |<br>      docker run --network scan_net --volume $(pwd):/hawk:r --tty --rm \<br>        --env API_KEY=&quot;hawk.${HAWK_API_ID}.${HAWK_API_SECRET}&quot; \<br>        --env BRANCH=GitLab:${CI_COMMIT_BRANCH} \<br>        --env NO_COLOR=true \<br>        stackhawk/hawkscan:latest stackhawk.yml stackhawk-gitlab.yml</pre><p>Here we used an override yml file and configuration call to tell the scanner some new things. That override file looks like this:</p><pre>app:<br>  env: GitLab-CI<br>  # The url of your application to scan<br>  host: <a href="http://vuln-django:8020/">http://vuln-django:8020</a> # (required)</pre><p>We are overriding two settings in the yml file: env and host. The host override is pretty simple, just identifying how the scanner can find the application, so for this configuration we gave it a simple, short name. The env is so I can tell in the StackHawk app which environment ran my scan. I could have other pieces of technology introduce or remove security bugs here, so I want to be able to differentiate. The StackHawk scanner will make the Environment in the Portal GitLab-CI.</p><p>( <em>Interestingly, We had a customer use this to identify git branch name.. They wanted to know which branch introduced any issues they found. I think this is a really neat way to think about how to group results, but I think I prefer my Environment more loosely grouped, like CI/CD or GitLab.. I will and I will push that branch name to a Tags feature we will implement later.</em>)</p><p>Now I have a configured GitLab Runner for my Django project, with the output looking like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AEC4GrqWK4ggaBMD.png" /></figure><p>And the results in the StackHawk Platform look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OKd7D417fNYTSwNU.png" /></figure><h3>Now it’s Easy to Know Before You Go!</h3><p>As you can see, it’s really easy to implement DAST AppSec Scanning into the GitLab CI/CD pipeline and have the results available in an organized fashion that can help you understand the AppSec bugs that may exist in your application before it goes live. If you’d like to integrate StackHawk into your CI/CD pipeline, sign up for StackHawk <a href="https://www.stackhawk.com/">Early Access</a> and we’ll get you started. Also, if you would like to play with <a href="https://github.com/stackhawk/vulny_django_play">my Django app</a>, feel free to fork it and use it to test out StackHawk in your CI pipeline.</p><p><em>Originally published at </em><a href="https://www.stackhawk.com/blog/using-stackhawk-in-gitlab-know-before-you-go-live/"><em>https://www.stackhawk.com</em></a><em> on April 21, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac052a04daee" width="1" height="1" alt=""><hr><p><a href="https://medium.com/stackhawk/using-stackhawk-in-gitlab-know-before-you-go-live-stackhawk-ac052a04daee">Using StackHawk in GitLab Know Before You Go (Live) — StackHawk</a> was originally published in <a href="https://medium.com/stackhawk">StackHawk</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scanning the Damn Vulnerable Web App with StackHawk — StackHawk]]></title>
            <link>https://medium.com/stackhawk/scanning-the-damn-vulnerable-web-app-with-stackhawk-stackhawk-3631251903cf?source=rss-74b80228b4b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/3631251903cf</guid>
            <category><![CDATA[appsec]]></category>
            <category><![CDATA[devsecops]]></category>
            <category><![CDATA[dast]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Scott Gerlach]]></dc:creator>
            <pubDate>Thu, 16 Apr 2020 15:19:00 GMT</pubDate>
            <atom:updated>2020-04-18T17:48:03.412Z</atom:updated>
            <content:encoded><![CDATA[<h3>Scanning the Damn Vulnerable Web App with StackHawk — StackHawk</h3><p>When we first introduced StackHawk to some of our close friends in the security industry and asked them to try it out, they tested it the same way we did. They ran HawkScan through its paces with one of the many vulnerable web applications security professionals set up online to help the community learn. They did this to have a semi-known outcome to see how StackHawk works. Enter Damn Vulnerable Web App.</p><p>The <a href="http://www.dvwa.co.uk/">Damn Vulnerable Web App</a> (DVWA) is a tool made by <a href="https://dewhurstsecurity.com/">Dewhurst Security</a> to help security professionals and developers alike find and exploit <a href="https://owasp.org/www-project-top-ten/">Web Application Vulnerabilities</a>. It’s a great tool and worth checking out if you haven’t already.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*op3SfLHTkvI8J90f.png" /></figure><p>Below are the details on how you can test StackHawk with the DVWA yourself. Note that this whole process can be done in ~10 minutes and provides a great example of how StackHawk works.</p><h3>Initial Set Up</h3><p>StackHawk is built to find security bugs in a running application. To get DVWA up and running, I went the easy route and deployed the web app via a <a href="https://www.docker.com/resources/what-container">Docker container</a>. This gave me the freedom to use the app and not worry about fiddling with a LAMP stack. The default docker instructions docker run --rm -it -p 80:80 vulnerables/web-dvwa exposes DVWA to the host machine interfaces on port 80, including <a href="http://localhost/">http://localhost/</a>. From there, I could easily log in to the web interface and ensure everything was working as expected.</p><p>If you’re following along at home, you’ll have to follow three simple steps to fully get DVWA up and running:<br> Open <a href="http://localhost/">http://localhost</a> and log in to the admin console using username: admin and password: admin<br> Scroll to the bottom of the page to initialize the application database by clicking Create / Reset Database<br> Confirm you can log in again with username: admin and password: password and make sure you see the left side menu this time.</p><h3>Starting a StackHawk Scan</h3><p>To start, if you don’t have an API key, please make your way over to <a href="https://stackhawk.com/">https://stackhawk.com</a> and signup to get access. Once you have an API key and have defined an application and received the applicationId for your test you are ready to configure the scanner.</p><p>StackHawk has a simplified configuration file written in <a href="https://yaml.org/">YAML</a> to make implementation easier and scalable. Automating scanning across the wide variety of applications out there introduces significant complexity, but we’ve simplified the configuration so you can get up and running quickly.</p><p>Since we know the application lives on <a href="http://localhost/,">http://localhost/,</a> the beginning of our config file (stackhawk.yml) should look something like this:</p><pre>app:<br>  applicationId: {your applicationID uuid}<br>  env: Development<br># The url of the application to scan<br>  host: <a href="http://localhost/">http://localhost</a> # (required)<br>hawk:<br>#  # The web crawler / spider configuration<br>  spider:<br>#    # Enable the base spider for discovering your app&#39;s routes<br>    base: true # (default)</pre><p>Within this section of our config file, we tell the scanner what the StackHawk applicationId is, what environment DVWA is running in, where the application can be found and what web crawling to do. In this instance, DVWA is a PHP application, so the base spider will work nicely to find and parse links and forms in the page (we support single page apps too — <a href="https://docs.stackhawk.com/hawkscan/configuration/openapi-configuration.html">check out the docs</a>). If we save this file to a directory on our local computer, say ~/dvwatest/, we can then begin a scanning run. To start StackHawk with our <em>stackhawk.yml</em> file defined, we simply run the command:</p><pre>cd ~/dvwatest/<br>docker run --rm -v $(pwd):/hawk:rw -it stackhawk/hawkscan:latest stackhawk.yml</pre><p>Since all of the functionality of the web app is behind Form/Session authentication, running HawkScan at this point only discovers the login.php page. While that part is nifty, there’s no real meat there.</p><p>DVWA comes with a default admin user that we set the password for in the beginning part of the article. Reviewing the login form, there is Login, the name of the Submit button with the value Login. It’s important for StackHawk to know that, because that’s how it will try to log in. There are also three different fields submitted:</p><p>The first two fields are fairly self explanatory. The third field, user_token, is the <a href="https://owasp.org/www-community/attacks/csrf">CSRF field</a> that helps prevent <a href="https://owasp.org/www-community/attacks/Credential_stuffing">form stuffing</a>, or automated attempts to bypass the login page. The value for user_token is generated by the server and displayed in the page. The server expects that value back when the user attempts a login to validate the form was read and submitted in a regular fashion. It’s important for StackHawk to know the user_token as well so it can scrape the login page, find the value, pass it back to the server and complete the CSRF challenge. With all these additions, our config file is starting to look a bit more robust.</p><p>We also need to set up some of the authentication parameters for the scanner to be able to log into the DVWA. We know it uses Form based authentication.</p><p>When we made HawkScan, one the the things we wanted to improve was the Authentication process. The base scanner is sort of agnostic to whether or not your authentication worked and getting feedback to tell if authentication actually worked is at best, difficult. We’ve made that process better in the authentication section. We ask for a URL and a response code that should be accessible after authentication. When those succeed, the scanner continues. If they don’t the scanner stops and give you feedback about what didn’t go correctly in authentication.</p><pre>app:<br>  applicationId: {your applicationID uuid}<br>  env: Development<br>  # The url of your application to scan<br>  host: <a href="http://localhost/">http://localhost</a> # (required)<br>  # Our scanner&#39;s capability is still in Alpha; If we notice a bug we&#39;ll use this email to reach out or provide a fix.<br>  # We will never use this contact for marketing purposes.<br>  contactEmail: <a href="/service/mailto:steve.s.hawk@example.com">steve.s.hawk@example.com</a> # (optional)<br>  # The risk level of the app<br>  riskLevel: MEDIUM # The DVWA poses a Medium risk to my fictional company<br>  # The type of data sensitivity the web app maintains<br>  appDataType: PII # It holds PII data and that’s pretty much it<br> #  # The name of your anti csrf parameter<br>  antiCsrfParam: user_token # here we define the CSRF field name so the scanner can pick it up</pre><pre>#  # Form POST based authentication configuration for scanning as a user.<br>#  # Enabling will force the scanner to scan as an<br>#  # authenticated user of your app.<br>#  # Authenticated requests will pass cookies received from the form POST<br>#  # to maintain authentication.<br>  authentication:<br>#    # A regex to match against http responses to determine if the scan user is<br>#    # still logged in to your app<br>    loggedInIndicator: &quot;\\QLogout\\E&quot; # (required)<br>#    # A regex to match against http responses to determine if the scan user is<br>#    # logged out of your app<br>    loggedOutIndicator: &quot;\\QloginInput\\E&quot; # (required)<br>#   # A page that is only accessible being logged in. We will try to access this page<br>#   # to validate authentication worked<br>    testPath:<br>      path: /vulnerabilities/javascript/<br>      type: HEADER<br>      success: &quot;.*200.*&quot;<br>    usernamePassword:<br>      type: FORM # (optional)<br>#    # The route to a form POST to authenticate a user<br>      loginPath: /login.php # (required)<br>#    # The route to logout a user<br>      logoutPath: /logout.php # (required)<br>#    # The username field name in your authentication form<br>      usernameField: username # (required)<br>#    # The password field name in your authentication form.<br>      passwordField: password # (required)<br>#    # Other parameters that may be required by your log in form<br>      otherParams: # (optional)<br>        - name: Login  # The login form parameter is needed to make login work<br>          val: &quot;Login&quot;<br>        - name: &quot;security&quot; # I&#39;m not sure what this does in the app, but scans don&#39;t work without it<br>          val: &quot;low&quot;<br>#    # The username to authenticate as when scanning<br>      scanUsername: admin # (required)<br>#    # The password of the scanUsername<br>      scanPassword: password # (required)</pre><pre>hawk:<br>#  # Web crawler / spider configuration<br>  spider:<br>#    # Enable the base spider for discovering your app&#39;s routes<br>    base: true # (default)</pre><p>With this config file, StackHawk knows how to log in to the app. However, when I ran some scans, the results and discovered URLs are not quite what I was expecting. There were not enough URLs and WAY less vulnerabilities than I expected. When investigating the DVWA in my browser, I can see a few things that I must tell StackHawk for it to do a more thorough job.</p><p>Browsing to the Logout Menu, the application instantly logs me out. What that means, is the scanner is logging me into the application to do the spidering of the app, browsing the links it can find and logging me out before it can test any of the pages. I need to tell the scanner about these things. My config now looks like this.</p><pre>app:<br>  applicationId: {your applicationID uuid}<br>  env: Development<br>  # The url of your application to scan<br>  host: <a href="http://localhost/">http://localhost</a> # (required)<br>  # Our scanner&#39;s capability is still in Alpha; If we notice a bug we&#39;ll use this email to reach out or provide a fix.<br>  # We will never use this contact for marketing purposes.<br>  contactEmail: <a href="/service/mailto:steve.s.hawk@example.com">steve.s.hawk@example.com</a> # (optional)<br>  # The risk level of the app<br>  riskLevel: MEDIUM # The DVWA poses a Medium risk to my fictional company<br>  # The type of data sensitivity the web app maintains<br>  appDataType: PII # It holds PII data and that’s pretty much it<br>  sessionTokens: # the session cookies DVWA uses in some fashion<br>    - &quot;PHPSESSID&quot;<br>    - &quot;dvwaSession&quot;</pre><pre>#  # The name of your anti csrf parameter<br>  antiCsrfParam: user_token # here we define the CSRF field name so the scanner can pick it up<br>  # What pages to not scan<br>  excludePaths:<br>    -&quot;logout.php&quot; # the scanner will log itself out if you don&#39;t ignore it</pre><pre>#  # Form POST based authentication configuration for scanning as a user.<br>#  # Enabling will force the scanner to scan as an<br>#  # authenticated user of your app.<br>#  # Authenticated requests will pass cookies received from the form POST<br>#  # to maintain authentication.<br>  formAuth: # This app uses Form Based auth<br>#    # The route to a form POST to authenticate a user<br>    loginPath: /login.php # this is the login page<br>#    # The route to logout a user<br>    logoutPath: /logout.php # tell the scanner where logout happens.<br>#    # The username field name in your authentication form<br>    usernameField: username # here is the name of a field in the login form<br>#    # The password field name in your authentication form.<br>    passwordField: password # here is the name of a field in the login form<br>#    # A regex to match against http responses to determine if the scan user is<br>#    # still logged in to your app<br>    loggedInIndicator: &quot;\\QLogout\\E&quot; # the \\Q and \\E are important indicators, but this field also take standard regex<br>#    # A regex to match against http responses to determine if the scan user is<br>#    # logged out of your app<br>    loggedOutIndicator: &quot;\\QloginInput\\E&quot; #<br>#    # Other parameters that may be required by your log in form</pre><pre>#    # Other parameters that may be required by your log in form<br>    otherParams: # (optional)<br>      - name: Login  # The login form parameter is needed to make login work<br>        val: &quot;Login&quot;<br>#    # The username to authenticate as when scanning<br>    scanUsername: admin # DVWA default<br>#    # The password of the scanUsername<br>    scanPassword: password # DVWA default<br>hawk:<br>#  # Web crawler / spider configuration<br>  spider:<br>#    # Enable the base spider for discovering your app&#39;s routes<br>    base: true # (default)</pre><p>Now we are starting to get better results, but something is still missing causing the scanner to not find all the links and test the pages. While we have described our application well, the scanner is still doing something incorrectly with the session when spidering links in the app. We can tell it to not browse or test some of the pages that are giving us trouble. For instance, the setup.php page has a button that rebuilds the entire database, that’s probably not helping our cause. Also, the security.php page has a button that turns on PHPIDS and make the app more secure and while that’s great, it makes our test not work well. The last one we are concerned about is the /vulnerabilities/csrf/ path that has the ability to change the users password. While that doesn&#39;t affect the current scan, the scanner will change the password of the user and confuse you a lot!</p><pre># Complete configuration for DWVA StackHawk Scan<br>app:<br>  applicationId: {your applicationID uuid}<br>  env: Development<br>  # The url of your application to scan<br>  host: <a href="http://localhost/">http://localhost</a> # (required)<br>  # Our scanner&#39;s capability is still in Alpha; If we notice a bug we&#39;ll use this email to reach out or provide a fix.<br>  # We will never use this contact for marketing purposes.<br>  contactEmail: <a href="/service/mailto:steve.s.hawk@example.com">steve.s.hawk@example.com</a> # (optional)<br>  # The risk level of the app<br>  riskLevel: MEDIUM # The DVWA poses a Medium risk to my fictional company<br>  # The type of data sensitivity the web app maintains<br>  appDataType: PII # It holds PII data and that’s pretty much it<br>  sessionTokens: # the session cookies DVWA uses in some fashion<br>    - &quot;PHPSESSID&quot;<br>    - &quot;dvwaSession&quot;<br> <br>#  # The name of your anti csrf parameter<br>  antiCsrfParam: user_token # here we define the CSRF field name so the scanner can pick it up<br>  excludePaths:<br>    - &quot;/setup.php&quot; # The scanner resets the DB :)<br>    - &quot;/security.php&quot; #the scanner turns on PHPIDS here<br>    - &quot;/vulnerabilities/csrf/*&quot; #this page changes the admin password<br>    - &quot;/logout.php&quot; # the scanner will log itself out if you don&#39;t ignore here</pre><pre>#  # Form POST based authentication configuration for scanning as a user.<br>#  # Enabling will force the scanner to scan as an<br>#  # authenticated user of your app.<br>#  # Authenticated requests will pass cookies received from the form POST<br>#  # to maintain authentication.<br>  formAuth: # This app uses Form Based auth<br>#    # The route to a form POST to authenticate a user<br>    loginPath: /login.php # this is the login page<br>#    # The route to logout a user<br>    logoutPath: /logout.php # tell the scanner where logout happens.<br>#    # The username field name in your authentication form<br>    usernameField: username # here is the name of a field in the login form<br>#    # The password field name in your authentication form.<br>    passwordField: password # here is the name of a field in the login form<br>#    # A regex to match against http responses to determine if the scan user is<br>#    # still logged in to your app<br>    loggedInIndicator: &quot;\\QLogout\\E&quot; # the \\Q and \\E are important indicators, but this field also take standard regex<br>#    # A regex to match against http responses to determine if the scan user is<br>#    # logged out of your app<br>    loggedOutIndicator: &quot;\\QloginInput\\E&quot; #<br>#    # Other parameters that may be required by your log in form</pre><pre>#    # Other parameters that may be required by your log in form<br>    otherParams: # (optional)<br>      - name: Login  # The login form parameter is needed to make login work<br>        val: &quot;Login&quot;<br>#    # The username to authenticate as when scanning<br>    scanUsername: admin # DVWA default<br>#    # The password of the scanUsername<br>    scanPassword: password # DVWA default<br>hawk:<br>#  # Web crawler / spider configuration<br>  spider:<br>#    # Enable the base spider for discovering your app&#39;s routes<br>    base: true # (default)</pre><p>Now we have a working config for DVWA and can effectively scan the app and get results from the scanner. All of the results of these scans should be viewable from the direct link printed at the end of the scan in the terminal. From there you should be able to browse each of the issue and find the request response pairs that made an alert trigger.</p><p>While the iteration to make this work was not difficult, you do need to understand how the application behaves and what things could be causing the scanner to not be able to do its job. Now we have a working config for DVWA and can effectively scan the app and get results from the scanner. While the iteration to make this work was not difficult, you do need to understand how the application behaves and what things could be causing the scanner to not be able to do its job. To test StackHawk scanning the Damn Vulnerable Web App or your own application, sign up for an account at <a href="https://www.stackhawk.com/">stackhawk.com</a></p><p><em>Originally published at </em><a href="https://www.stackhawk.com/blog/scanning-the-damn-vulnerable-web-app-with-stackhawk/"><em>https://www.stackhawk.com</em></a><em> on April 16, 2020.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3631251903cf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/stackhawk/scanning-the-damn-vulnerable-web-app-with-stackhawk-stackhawk-3631251903cf">Scanning the Damn Vulnerable Web App with StackHawk — StackHawk</a> was originally published in <a href="https://medium.com/stackhawk">StackHawk</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>