Skip to content

righettod/toolbox-pentest-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🏭 Welcome to my digital forge

πŸ’š Image full credits go to Dirk Hoenes: https://pixabay.com/users/ptdh-275507.

MadeWitVSCode MadeWithDocker AutomatedWith AuditedWith

Tip

Even though this box is primarily intended for offensive operation, many tools and scripts can also be used for defensive purposes, for example, in CI/CD pipelines as security validation.

πŸ“’ Quick access:

🎯 The goal of this image is to provide an, always up to date "box", containing materials (tools + scripts) useful in the context of the assessment of a web-based application: site, API, etc.

πŸ“’ The image is based on the alpine base image. Previously, it was based on the kali-rolling image but the final size of the image, once the toolbox was built, was really too heavy (more than 14GB).

πŸ“± Recently, I started to add content for mobile assessment to gather information/tools in a single box.

🏷️ Issues with the label idea, contains general ideas on a project/code/script/payload/research/etc not necessarily directly linked to the toolbox itself. Indeed, as this project is my central toolbox's forge, I used it also to gather/centralize my ideas.

πŸ”‹ Health status

Audit the toolbox image

Check cheat sheet links validity

Update scripts index

Update nmap scripts index

Build and deploy the toolbox image

Build PostgreSQL extension

Build DLL Hijacking library

Build Hash Extender linux binary

βš’οΈ Box enhancement approach

Projects

Approach

sequenceDiagram
    participant T as Toolbox  
    participant S as SecLists
    participant N as Nuclei templates
    participant P as Param-Miner
    alt Is a missing discovery dictionary entry
        T->>S: Propose a PR with the missing element
        S->>T: Get updates from the GitHub repository once the PR is merged
    end 
    alt Is a missing detection generic point
        T->>N: Propose a PR with the missing template
        N->>T: Get updates from the GitHub repository once the PR is merged
    end
    alt Is a missing hidden http parameter/header entry
        T->>P: Propose a PR with the missing element
        P->>T: Get updates from the GitHub repository once the PR is merged
    end     
    alt Is a missing useful existing tool
        T->>T: Add the tool in a way to always use the latest version
    end       
    alt Is a missing specific need or without existing tool
        T->>T: Add a new custom scripts
    end  
Loading

🐳 Toolbox ecosystem

I have created and maintain several public toolboxes (as docker images), for which, the present toolbox toolbox-pentest-web is the central one:

mindmap
  root["πŸ’»toolbox-pentest-web"]
    id1("πŸ”¬toolbox-codescan")
    id2("πŸ“‹toolbox-jwt")
    id3("πŸ“toolbox-regex")
    id4("🏹toolbox-patator")
Loading
  • toolbox-pentest-web: Toolbox for pentest of web based application.
  • toolbox-codescan: Toolbox to perform offline scanning of a code base.
  • toolbox-jwt: Toolbox with different scripts having for the objective to perform different kinds of attacks against JWT tokens.
  • toolbox-regex: Toolbox to have a local instance of RegExr to create regex against sensitive/private content.
  • toolbox-patator: Toolbox to have a always up to date docker image of the tools named patator.

πŸ–₯️ IDE VSCode

πŸ“š What does it contain?

Build

The folder build contains utility internal scripts and materials used to build the docker image.

Tools

All tools are installed in the folder /tools and a transfer zone between the container and the host has been defined via the folder /tools/reports.

Helper scripts

Tip

The index of all the scripts available is automatically updated, at each push on the master branch, via this workflow.

The folder scripts contains helper scripts for some operations using embedded tools.

Misc

Tip

The trial of the software Foxit PDF Editor can be used to create custom malicious PDF files.

Tip

This app or site can be used to generate a XAdES/CAdES/PAdES/JAdES signed files.

Tip

The VBA code, stored in the file malicious-office-macro-vba.vbs, can be used to create a custom office malicious file.

The folder misc contains materials that can be used for testing specific cases like for example when an app is using:

πŸ’» Use the code below to extract the executable file (LaZagne.exe) from the PDF file doc-pdf-with-malicious-files-concatenated.pdf:

delimiter = "5b4e455746494c455d"  # String "[NEWFILE]" encoded in HEX
with open("doc-pdf-with-malicious-files-concatenated.pdf", mode="rb") as f:
    content_hex = f.read().hex()
delimiter_position = content_hex.find(delimiter)
bin_file_hex = content_hex[delimiter_position + len(delimiter):]
bin_file_bytes = bytes.fromhex(bin_file_hex)
with open("malicious-files.exe", mode="wb") as f:
    f.write(bin_file_bytes[1:])

Templates

The folder templates contains several scripts/files that can be used, as a basis for custom scripts, to speed-up the implementation of a POC.

Dictionaries

The folder dictionaries contains several, home-made custom dictionaries, that can be used for discovery operations.

Technical hints

This file contains several technical hints for different kinds of context/issues/goals.

πŸ’» It's my tailor made cheat sheet.

πŸ”¨ Build image locally

Use the following set of commands:

$ git clone https://github.com/righettod/toolbox-pentest-web.git
$ cd toolbox-pentest-web
$ docker build . -t righettod/toolbox-pentest-web --file Dockerfile
...

πŸ“‘ Container usage

On a docker host for direct access

Native docker on Linux or MacOS

# Create a volume to share files with the container (ex: reports)
$ docker volume create --name shared_space
$ docker volume inspect shared_space
# Run container
$ docker run -v shared_space:/tools/reports -p 127.0.0.1:80:80 -i -t righettod/toolbox-pentest-web /bin/zsh
$ docker run -v shared_space:/tools/reports -p 192.168.206.128:80:80 -p 192.168.206.128:443:443 -i -t righettod/toolbox-pentest-web /bin/zsh
# Build image into local cache
$ docker build -t righettod/toolbox-pentest-web .
# Remove image from local cache
$ docker rmi -f righettod/toolbox-pentest-web

Docker for Windows

rem Run container and defines a shared folder
C:\> docker run -v F:/SharedFolder:/tools/reports -p 127.0.0.1:80:80 -i -t righettod/toolbox-pentest-web /bin/zsh

For remote ssh access

Caution

Private key to use for SSH authentication is here. This box is intended to be used as a toolbox for a short running period.

Important

When deployed on Kubernetes, the SYS_CHROOT / AUDIT_WRITE / NET_RAW capabilities are required in the security context.

  1. Run the container on the target docker host using the following command line:
$ docker run -p 22:22 righettod/toolbox-pentest-web
Server listening on 0.0.0.0 port 22.
Server listening on :: port 22.
...
  1. Access the container, via SSH, using the following command:
$ ssh -i ~/.ssh/ssh-private-key.pem root@[DOCKER_HOST_IP]
➜  ~

Add "StrictHostKeyChecking=no" in case of trouble with the remote keys because they are unique for each built image:

$ ssh -o "StrictHostKeyChecking=no" -i ~/.ssh/toolbox-ssh-private-key.pem root@[DOCKER_HOST_IP]
➜  ~

πŸ“¦ Container registries

Image is published into the following registries, every week, via this workflow:

πŸ›‘οΈ Security

  • Refer here for information about reporting a vulnerability.
  • Image is audited every week, by Snyk and this workflow, to detect presence of any vulnerability.