logo

Academy

Gherkin template: VbD

The template for the .feature file that you must send with each vbd-hacking solution.

This is the template for the *.feature file. You must send this file with a vbd-hacking solution.

## Version 1.4.1
## language: en

#Keep comments if they start with double sharp ##

#M: Mandatory
#O: Optional

#{} are template tags. A final feature must not contain any of these.
#<> are gherkin tags. They let you make variables. You use them in a
#table, for example in the Background and the Extraction scenarios.

Feature: #M
  """
  In this section you give general information about the site that you
  hack. Also give your goal and your recommendation to remediate the
  vulnerability.
  """
  TOE: #M: TOE containing the vulnerability
    {toe}
  Category: #O: Category containing the vulnerability
    {cat}
  Location: #M: Location of the page/endpoint/server/file with the vulnerability
    {url - field} #For a web app: http://sdfsdf.com/login.php - user (field)
    #OR
    {url - header} #For a web app: http://asdf.com/qwe.php - Cookie (header)
    #OR
    {ip:port TCP/UDP} #For a server: 192.168.1.1:80 TCP
    #OR
    {filepath:line} #For an application: /path/of/file.c:34 (34 is the line)
  CWE: #M: Vulnerability type according to the Common Weakness Enumeration:
    CWE-{CWE-codenumber}: {codename} #link:https://cwe.mitre.org/data/index.html
  Rule: #M: Fluid Attacks' non-compliant rule
    REQ.{rule-number}: {rule-link}
    #link:https://docs.fluidattacks.com/criteria/requirements/
  Goal: #M: One-liner description of what you are intending to achieve
    {description}
  Recommendation:  #M: One-liner advice on how to fix the vulnerability
    {recommendation}

  Background: #M
  """
  In this section you give the names and the versions of the software
  that you used for the attack. Examples are the operating system and
  the browser. Also give the detailed data of the TOE. List the
  relevant services with their versions. List also the operating
  system and the kernel with their versions, and the other data of
  the context.
  """
  Hacker's software:
    | <Software name> | <Version>   |
    | {os}            | {version 1} |
    | {browser}       | {version 2} |
    | {name1}         | {version 3} |
  TOE information:
    Given I am accessing the site {www.site.com}
    And enter a php site that gives me {A}
    And the server is running MySQL version {B}
    And PHP version {C}
    And SSH version {D}
    And is running on Ubuntu {E} with kernel {F}

  Scenario: Normal use case #M
    """
    In this section you describe what the site does in normal
    conditions.
    """
  {description} #Short description of what this section does
    Given I access {A}
    And open {B}
    Then I can see {C}
    And {D}

  Scenario: Static detection #M (Only optional if code is inaccessible)
  """
  In this scenario you identify the portion of code that causes the
  vulnerability, and you cite it. This helps you give a fix for the
  vulnerability in the sections after this one. Cite the explicit
  lines that generate the vulnerability. Use one of these two formats
  for more than one line:
  1 - lines 1, 2, 3, 4, ..., n
  2 - line 1 to line n
  """
  {cause} #Short description of what causes the vulnerability
    When I look at the code {A} #How did you find the vulnerability in the code?
    Then I can see that {FUNCTION1} causes the vulnerability, from
    line 141 to line 142
    And {FUNCTION2} in lines 143, 144
    """
    141  CODE
    142  CODE
    143  CODE
    144  CODE
    """
    Then I can conclude {C} #What conclusions can you draw from this?

  Scenario: Dynamic detection #M
  """
  In this scenario you detect the vulnerability in a practical way.
  You identify the attack vector that delivers a payload. This
  section usually uses a tool such as Burp, Msfconsole or SQLmap.
  """
  {cause} #Short description of the vulnerability
    Given {A}
    And {B}
    Then I can execute the following command:
    """
    $ COMMAND
    """
    Then I get the output:
    """
    ... #Unimportant lines
    OUTPUT
    ... #Unimportant lines
    """
    Then I can conclude that {C} #What conclusions can you draw from this?

  Scenario: Exploitation #M
  """
  After you detect the vulnerability, the next step is to exploit it.
  In this section you exploit the target. Try to achieve the goal that
  the file gives before this scenario.
  """
  {description} #Short description of what this section does
    Given {A} #Which conditions do you need to implement the exploit?
    And {B}
    Then I can execute the following command:
    """
    $ COMMAND
    """
    Then I get the output:
    """
    ... #Unimportant lines
    OUTPUT
    ... #Unimportant lines
    """
    Then I can conclude that {C} #What can you conclude from the exploitation?

  Scenario: Maintaining access #O
  """
  Include this section if you must give more information about the
  malware that you deploy. This malware keeps access to the target
  after someone patches the first vulnerability.
  """
  {description} #Short description of what this section does
    Given {A} #Which conditions do you need to implement this?
    And {B}
    Then I can upload the file {C}:
    Then I get access by running:
    """
    $ COMMAND
    """
    Then I can conclude that {D} #What can you conclude from this?

  Scenario Outline: Extraction #O
  """
  Include this section if you must give more information about the
  extraction of sensitive data.
  """
  {description} #Short description of what this section does
    Given {A} #Which conditions do you need to implement this?
    And {B}
    Then I can access <file> and read <output>
    Examples:
      | <file>      | <output> |
      | /etc/passwd |   OUTPUT |
      | /etc/shadow |   OUTPUT |
    Then I can conclude that {C} #What can you conclude from this?

  Scenario: Destruction #O
  """
  Include this section if you must give more information about the
  destruction of protected data in the target.
  """
  {description} #Short description of what this section does
    Given {A} #Which conditions do you need to implement this?
    And {B}
    Then remove files {C} with the command:
    """
    $ COMMAND
    """
    Then I can conclude that {D} #What can you conclude from this?

  Scenario: Covering tracks #O
  """
  Include this section if you must give more information about the
  logs. Include also the other data that can show your presence.
  """
  {description} #Short description of what this section does
    Given {A} #Which conditions do you need to implement this?
    And {B}
    Then I can modify or delete files {C} with command:
    """
    $ COMMAND
    """
    Then I can conclude that {D} #What can you conclude from this?

  Scenario: Denial of service #O
  """
  Include this section if you must give more information about a
  denial of service attack on the target.
  """
  {description} #Short description of what this section does
    Given {A} #Which conditions do you need to implement this?
    And {B}
    Then I can stress the target by doing {C} with the command:
    """
    $ COMMAND
    """
    Then If I try to access the site by doing {D}, it does not load
    Then I can conclude that {E} #What can you conclude from this?

  Scenario: Remediation #M
  """
  In this section you take the code of the Static detection scenario,
  and you modify it to patch the vulnerability. Then run the same
  attack vector on the target with the patched code. This proves that
  the patch corrects the vulnerability. If you do not have the source
  code, this scenario gives a high-level explanation. Explain the
  usual fix for such a vulnerability.
  """
  {description} #Short description of how you remediate the vulnerability
    Given I have patched the code by doing {A}
    And {B}
    """
    141 CODE
    142 CODE
    143 CODE
    """
    Then If I re-run my exploit {C} with the command:
    """
    $ COMMAND
    """
    Then I get:
    """
    ... #Unimportant lines
    FAILED EXPLOIT OUTPUT
    ... #Unimportant lines
    """
    Then I can confirm that the patch corrects the vulnerability

  Scenario: Scoring #M
  """
  The scoring lets you give a standard metric. This metric shows how
  dangerous the vulnerability is, from three different views.
  """
  Severity scoring according to CVSSv3 standard
  Base: Attributes that are constants over time and organizations
    {basenumber}/10 ({baseword}) - {basevectorstring}
  Temporal: Attributes that measure the exploit's popularity and fixability
    {tempnumber}/10 ({tempword}) - {tempvectorstring}
  Environmental: Unique and relevant attributes to a specific user environment
    {envnumber}/10 ({envword}) - {envvectorstring}
  #Example
  Severity scoring according to CVSSv3 standard
  Base: Attributes that are constants over time and organizations
    8.3/10 (High) - AV:N/AC:H/PR:N/UI:R/S:C/C:H/I:H/A:H/
  Temporal: Attributes that measure the exploit's popularity and fixability
    7.9/10 (High) - E:H/RL:O/RC:C/
  Environmental: Unique and relevant attributes to a specific user environment
    6.4/10 (Medium) - CR:L/IR:L/AR:L

  Scenario: Correlations #M
  """
  In this section you add the references to the other vulnerabilities
  that you found. With the current vulnerability, these can make a
  more powerful attack vector.
  """
    #If you found no correlation:
    This solution has no correlation at this date {yyyy-mm-dd}
    #If you found one or more correlations:
    vbd/{toe}/{vulnerability1}
      Given I do {A} #Provided by this vulnerability
      And {B} provided by {vulnerability1}
      When {C}
      Then I get {D}
      And {E}
    vbd/{toe}/{vulnerability2}
      Given I did {A}
      And {B}
      And {C} provided by {vulnerability2}
      Then I can do {E}
      Then I get {F}


  """
  Folder Naming Convention:
  The folder structure is vbd/toe/vulnerability/feature. You usually
  make a folder for each vulnerability that you find in a TOE.
  A vulnerability folder contains:
    - Only one feature file for the specific vulnerability
    - A LINK.lst file with a link to the site containing the vulnerability

  The standard for a vulnerability folder is <cwe-code>-<exploit-name>:
    - <cwe-code> is the code of the vulnerability, in four digits, according
      to the Common Weakness Enumeration
      (link:https://cwe.mitre.org/data/index.html)
    - <exploit-name> is the name of the vulnerability
  The VbD structure page owns this rule
  (link:https://academy.fluidattacks.com/docs/submit/structure/vbd/)
  Some examples are:
    - vbd/bwapp/0384-smgmt-cookies-httponly/
    - vbd/juice-shop/0079-xss-tier-2/
    - vbd/bricks/0564-login-1/
  """

NOTE: General criteria gives the hours of the review.