Logo
Published on
views

Bandit 28 Writeup

Authors
  • Name
    Pablo
    Twitter
    @pablousu
  • Name
    Maylen Echavez
    Twitter

Concepts to consider

Git Commit

In Git, a commit represents a snapshot of the repository at a specific point in time. It captures the state of all files tracked by Git, including their contents and directory structure, at the moment the commit is created. Each commit has a unique identifier (usually a SHA-1 hash) that distinguishes it from other commits in the repository.

Components of a Commit:

  • Snapshot: Represents the complete state of files at the time of the commit.
  • Author: The person who made the commit.
  • Timestamp: The date and time when the commit was made.
  • Commit message: A description provided by the author explaining the changes made in the commit.

Purpose of Commits:

  • Version Control: Commits allow developers to track changes made to the codebase over time. This facilitates collaboration, rollback to previous states, and identification of who made specific changes.
  • History: Commits form a chronological history of modifications, making it easier to understand the evolution of the project.

git checkout <commit>

The git checkout command is used to switch between different branches or to inspect previous commits within the repository. When you specify a commit ID (or other reference, such as a branch name) with git checkout, Git updates the working directory and the HEAD pointer to match the state of the repository at that particular commit.

  • Checking Out a Commit: When you check out a commit by its ID (git checkout <commit>), Git puts the repository into a "detached HEAD" state. This means HEAD (the symbolic name for the currently checked out commit) points directly to the commit you've checked out, rather than to a branch reference. In this state:
    • You can view files and their contents as they were at the time of the commit.
    • You can make experimental changes (though these changes won't belong to any branch unless you create a new branch).
    • Any commits made while in a detached HEAD state will be more challenging to access if you move back to a branch without recording the commit ID.

bandit 28

Task

There is a git repository at ssh://bandit28-git@localhost/home/bandit28-git/repo via the port 2220. The password for the user bandit28-git is the same as for the user bandit28.

Clone the repository and find the password for the next level.

Solution

  1. Listing Directory Contents:

    bandit27@bandit:/tmp/tmp.eix858EfHM$ ls
    repo
    
    • ls command lists the contents of the current directory (/tmp/tmp.eix858EfHM).
    • Here, it shows that there is a directory named repo within /tmp/tmp.eix858EfHM.
  2. Navigating into a Directory:

    bandit27@bandit:/tmp/tmp.eix858EfHM$ cd repo/
    
    • cd repo/ command changes the current directory to repo which is located within /tmp/tmp.eix858EfHM.
    • After this command, the prompt changes to indicate that we are now in /tmp/tmp.eix858EfHM/repo.
  3. Listing Contents of a Directory:

    bandit27@bandit:/tmp/tmp.eix858EfHM/repo$ ls
    README
    
    • ls command lists the contents of the current directory (/tmp/tmp.eix858EfHM/repo).
    • It shows that there is a file named README within /tmp/tmp.eix858EfHM/repo.
  4. Displaying File Contents:

    bandit27@bandit:/tmp/tmp.eix858EfHM/repo$ cat README
    The password to the next level is: AVanL161y9rsbcJIsFHuw35rjaOM19nR
    
    • cat README command displays the contents of the file README.
    • The output shows that the password to access the next level (bandit28) is AVanL161y9rsbcJIsFHuw35rjaOM19nR.