Bastion

[★☆☆] So much just from logs

Description

A routine inspection of authentication logs reveals an overwhelming pattern of suspicious access attempts to a dockized SSH bastion server. Inspect the logs and look for any unordinary activity.

part1_toolbox_logs.tar.gzarrow-up-right

Solution

Files

➜ 7z x .\part1_toolbox_logs.tar.gz^C
➜ 7z l .\part1_toolbox_logs.tar   
   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2025-04-18 19:38:41 D....            0            0  log
2025-04-18 19:38:49 .....         8512         8704  log\auth.log
2025-04-18 19:38:41 .....       592045       592384  log\auth.log.1
2025-04-18 19:37:41 .....        37476        37888  log\auth.log.2.gz
2025-04-18 19:36:41 .....        37057        37376  log\auth.log.3.gz
2025-04-18 19:35:41 .....        37216        37376  log\auth.log.4.gz
2025-04-18 19:34:40 .....        38972        39424  log\auth.log.5.gz
2025-04-18 19:33:37 .....            0            0  log\error.log
2025-04-18 19:33:37 .....            0            0  log\kern.log
2025-04-18 19:33:37 .....            0            0  log\mail.log
------------------- ----- ------------ ------------  ------------------------
2025-04-18 19:38:49             751278       753152  9 files, 1 folders

Cleanup

Ideally we want to know what was ran by malicious actor, search for COMMAND in SSH logs

Decode base64 payload

Decode hex:

circle-check

[★☆☆] Inspect the file system

Description

Based on your findings, continue your analysis with the docker layer of the docker container.

part2_docker_layer.tar.gzarrow-up-right

Solution

Extract and cleanup~

Malicious actor dropped this file from previous SSH inspection

Quick inspectionarrow-up-right gives the flag in plain text

Bastion.png

or just

circle-check

[★☆☆] Clean bastion

Description

The keylogger binary was passed to a malware analyst. Regarding the server, no further changes were detected, so the container was rebuilt and redeployed to a test environment. Ssh to the system.

WARNING: be aware that the system is running as a single container for all CTF players, so behave.

ssh://exp.cybergame.sk:7009 (ratchet:23ekmnjr4bh5tgvfhbejncidj)

Solution

We get the flag right after we login (?)

circle-check

[★☆☆] Feel free to dig in

Description

Inside the quarantined system, dig in and search for any remnants or traces of the attackers.

ssh://exp.cybergame.sk:7009

Solution

We are part of group wheel which is tied to sudo and after checking our capabilities we have unrestricted access. But su binary doesn't exist in container.

Find any binary to escalate privileges, like awk: https://gtfobins.github.io/gtfobins/awk/arrow-up-right

I thought this would be harder and then I started thinking simpler:

circle-check

[★☆☆] The backdoor culprit

Description

Explore the source git repository for the bastion server docker deployment and look for the source of the dropped backdoor.

part5_ssh-bastion-repo.tar.gzarrow-up-right

Solution

Nothing from commit history which catches eye...

circle-check

Last updated