hayha

Verifying CloudFormation deployments for intra-update sniping vulnerabilities

https://github.com/roptat/hayha

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.1%) to scientific vocabulary

Keywords

security
Last synced: 6 months ago · JSON representation ·

Repository

Verifying CloudFormation deployments for intra-update sniping vulnerabilities

Basic Info
  • Host: GitHub
  • Owner: roptat
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 43.9 KB
Statistics
  • Stars: 3
  • Watchers: 2
  • Forks: 2
  • Open Issues: 1
  • Releases: 0
Topics
security
Created over 4 years ago · Last pushed over 4 years ago
Metadata Files
Readme License Citation

README.md

Häyhä

Verifying CloudFormation deployments for intra-update sniping vulnerabilities.

Intra-update sniping vulnerabilities may happen during an update because of ordering issues between individual component updates. This tool is designed to find and report such issues.

You can read the academic paper here: http://marksantolucito.com/papers/tacas2021.pdf

Installation

Installing the tool is not necessary in order to run it.

With Guix

You can install Häyhä with the Guix package manager. It can run on any existing Linux distribution, and is guaranteed to not interact with its host distribution. Installing Guix is as simple as running the installation script. Once installed, you can run:

bash guix install `guix build -f guix.scm`

With pip

You can also install using pip:

bash pip install .

Development Environment

To develop (and run) Häyhä, you need to install pyyaml. An easy way to do so is by using a Guix environment:

bash guix environment -l guix.scm

You may also want to install graphviz (for the dot command) and an image viewer.

Usage

You should run Häyhä before running an upgrade on your CloudFormation infrastructure. We suppose that you have a file that describes your current infrastructure, as JSON or YAML, and another file that describes your target (desired new) infrastructure, in one of these formats.

Häyhä needs a one of two commands: graph or check to run, and one or two CloudFormation files, in JSON or YAML format. The usage is the following:

usage: run.py [-h] -i INITIAL [-t TARGET] ACTION

You can use -h to show a short help message. ACTION is one of graph or check. -i is for the initial file (or the only file to consider) and -t for the target file (the upgrade).

Graph

Häyhä is able to produce graphs for deployments that shows what a deployment looks like in terms of a dataflow graph. It will have a gray web node from which requests can be made by users of your infrastructure. A link represents the possibility of a request from a node to another. Red nodes represent security resources that control the requests to make sure they are authorized (firewall, authorizer, ...).

Each node contains the security level followed (in parenthesis) by the name of the resource.

Häyhä can draw two kinds of graph: the graph of a deployment if you only provide one file (whether initial or target) using the -i option or the upgrade graph if you provide two files (the initial deployment to the -i option and the target deployment to the -t option).

The upgrade graph represents every possible intermediate state during the deployment of the target infrastructure, but does not take any dependency into account.

This repository ships with two files, cloud1.json and cloud2.json that correspond to two versions of a vulnerable infrastructure. To run and visualize the output, you can run:

bash python3 run.py graph -i cloud1.json | dot -Tpng -o graph.png

Or for an upgrade graph that shows the vulnerability:

bash python3 run.py graph -i cloud1.json -t cloud2.json | dot -Tpng -o graph.png

Check

Häyhä is also able to check a planned upgrade of an infrastructure if you give it two files, like this:

bash python3 run.py check -i cloud1.json -t cloud2.json

The output will tell you if a vulnerability is found.

Possible Warnings

You might get a warning that some type is not supported. Unfortunately the tool relies on a mapping of types' configuration fields to an internal representation. There are many types of resources that can be used in an infrastructure. Even though we included the most current type of resources in this version, there are still many unsupported types. In that case, the tool completely ignores the resource when building the graphs and checking for vulnerabilities.

Vulnerabilities

If Häyhä finds a vulnerability under the check command, it will report it at the end. To prevent clutter on the screen, we only report one issue for each resource that has an issue, so after fixing issues, make sure to run the tool again!

There is a vulnerability when a resource can be referenced at a time it does not exist. This can happen when your target infrastructure creates a new resource and updates others to reference it. If these other resources do not depend on the new resource, they might be updated before and be vulnerable to an attacker registering your new resource before you do. The message will look like this:

<Resource AuthorizerToBeSniped> is accessible at a time it doesn't exist

This can be solved by adding a dependency in every resource that references it. In the example, you can add a DependsOn property to GreetingRequestPOST which references it and makes it required too early. Alternatively, use !Ref instead of Ref in GreetingRequestPOST's AuthorizerId field, as it will implicitly create a dependency.

There is a vulnerability when a resource can be accessed with the wrong security context. The message will look like this:

<Resource GreetingRequestPOST> is not sufficiently protected, it needs at least AuthorizerToBeSniped and is protected by None during upgrade. Add DependsOn properties to ensure correct security.

This means that there is a possible intermediate state in which your GreetingRequestPOST is not correctly protected. In fact, in at least one, it is not protected at all, even though it should be protected by at least AuthorizerToBeSniped.

If its security context becomes more strict in the target infrastructure, you should add a DependsOn from it to all the required security resources (here only to AuthorizerToBeSniped). This dependency will ensure correct ordering of upgrade operations and makes sure that the authorizer is present before upgrading GreetingRequestPOST to a more sensitive version.

If its security context becomes less strict in the target infrastructure, you should add a DependsOn from all the required security resources (here AuthorizerToBeSniped) to it. This dependency ensures correct ordering of upgrade operations and makes sure that the authorizer is only removed after upgrading GreetingRequestPOST to a less sensitive version.

Owner

  • Name: Julien Lepiller
  • Login: roptat
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - family-names: Lepiller
    given-names: Julien
    orcid: https://orcid.org/0000−0003−2284−5488
  - family-names: Piskac
    given-names: Ruzica
  - family-names: Schäf
    given-names: Martin
  - family-names: Santolucito
    given-names: Mark
    orcid: https://orcid.org/0000−0001−8646−4364
title: "Häyhä"
url: "https://github.com/roptat/hayha"
preferred-citation:
  type: conference-paper
  authors:
    - family-names: Lepiller
      given-names: Julien
      orcid: https://orcid.org/0000−0003−2284−5488
    - family-names: Piskac
      given-names: Ruzica
    - family-names: Schäf
      given-names: Martin
    - family-names: Santolucito
      given-names: Mark
      orcid: https://orcid.org/0000−0001−8646−4364
  doi: "10.1007/978-3-030-72013-1_6"
  title: "Analyzing Infrastructure as Code to Prevent Intra-update Sniping Vulnerabilities"
  collection-title: "Tools and Algorithms for the Construction and Analysis of Systems"
  year: 2021
  start: 105
  end: 123
  isbn: "978-3-030-72013-1"
  editors:
  - family-name: Groote
    given-names: Jan Friso
  - family-name: Larsen
    given-names: Kim Guldstrand
  publisher:
    name: "Springer International Publishing"

GitHub Events

Total
Last Year

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 9 days
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • brennenyu (2)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

setup.py pypi
  • pyyaml *