logo

Academy

Gherkin template: hack

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

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

## Version 2.0
## 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.

Feature: {code}-{category}-{site} #M
  """
  In this section you give general information: the challenge that
  you solve, your goal, and the location of the challenge.
  """
  Code: #O
    {code} #Code of the challenge if it exists
  Site: #M
    {site} #Site that has the challenge
  Category: #O
    {category} #Category of the challenge in the site, for example decoding
  User: #M
    {user} #Username used in the site when solving the challenge
  Goal: #M
    {goal} #Short description of your goal

  Background:
  """
  In this section you give the names and the versions of the software
  that you used to capture the flag. Examples are the operating
  system and the browser. Also give the data of the machine of the
  challenge. List the relevant services with their versions, and the
  operating system and the kernel with their versions.
  """
  Hacker's software:
    | <Software name> | <Version>   |
    | {os}            | {version 1} |
    | {browser}       | {version 2} |
    | {name1}         | {version 3} |
  Machine information:
    Given I am accessing the {machine} through a VPN
    And SSH with {command}
    And enter a console 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: {Fail|Success}:{method-used-1}
  """
  A scenario lets you describe, in time order, what you tried to
  solve the challenge.

  {Fail|Success}: Success if you caught the flag, and Fail if you did not
  {method-used-*}: Short description of what the scenario does

  Every shell command inside a docstring block must start with "$ ".
  A line without "$ " is tool output and not a command. The rule applies
  to every command that you type on your local machine, in every
  scenario. A short command such as echo, cp, cat or id is not an
  exception.

  An interactive session that prints its own prompt has a different rule.
  Examples are an SSH session, a Docker shell, and the shell of a C2
  framework such as Sliver. Write "$ " only before the local command that
  opens the session. Then leave the remote prompt as the tool prints it.
  Example:
    $ ssh [email protected]
    username@hostname:~$ whoami
    username

  When tool output inside a docstring shows the flag value, replace
  the literal flag with an accepted censored placeholder.
  Accepted forms: HTB{FLAG}, <flag>, [FLAG], HTB{xxxxxxxx}, <HIDDEN_FLAG>.
  Never write the real flag string anywhere in the .feature file.
  Example:
    $ cat flag.txt
    HTB{FLAG}
  """
    Given I am logged in the machine
    And I print {A}
    """
    $ {tool} {arguments}
    {tool output line 1}
    {tool output line 2}
    """
    Then I can see {B}
    Then I try to decrypt {B} by doing {C}
    """
    $ {tool} {arguments}
    {error or relevant output}
    """
    And get {D}
    Then I conclude that I cannot use {D} for my purpose
    And {C} did not work
    And I did not capture the flag

  Scenario: {Fail|Success}:{method-used-2}
    Given I print {A}
    """
    $ {tool} {arguments}
    {tool output line 1}
    {tool output line 2}
    """
    Then I can see {B}
    Then I try to decrypt {B} by doing {E}
    And get {F}
    Then I can read the flag from {F}
    """
    $ {command-that-reveals-flag}
    HTB{FLAG} #{censored placeholder, never the real flag value}
    """
    And I conclude that {E} worked
    And solved the challenge
    And I caught the flag

NOTE: General criteria gives the hours of the review.