Write-ups

AI Agent Security Lab
What was the task?
Investigate whether an attacker can manipulate or compromise an AI agent into taking an action beyond the authority of its user, assigned identity or permitted task. The project examines this through identity, delegated authorisation and reproducible security tests.

What did I observe?
The scripted AI agent could read Report A within its delegated permissions. Nine requests outside the authorised scope or with invalid credentials were denied without accessing protected data. A copy of the active synthetic bearer token still permitted the authorised read. These results establish the baseline for experiments with an LLM.

What did I learn?
Possession of a bearer token does not establish who presented it. Independent authorisation checks whether the assigned identity has permission to use the requested tool, perform the action and access the resource for the task set by the host. I checked the protected operation’s call count to verify every denial.

What is the security relevant takeaway?
A manipulated AI agent can propose an unauthorised action. Independent authorisation can stop the action before it reaches a protected resource. The planned experiments examine indirect prompt injection, identity compromise and excessive agency. Structured audit reasons are the next step towards reproducible evidence of how each decision was made.

Repository
AI Agent Security Lab on GitHub

RP2350 HID Security Lab
What was the task?
Design RP2350 firmware that verifies the connected host before releasing keyboard or mouse reports. Both the stored input sequence and simulated activity require proof that the host holds the enrolled private key.

A Linux agent running under an ordinary user account reads a fresh 32 byte random challenge from the board’s USB storage volume. It signs the protocol identifier, board identifier and challenge using ECDSA (Elliptic Curve Digital Signature Algorithm) on P-256 (a standardised 256 bit elliptic curve) with SHA-256 (Secure Hash Algorithm with a 256 bit digest). The firmware verifies the signature before enabling input.

What did I observe?
The host harness runs the firmware verifier with a fixed board identity and repeatable challenges. A signature from the enrolled key authorised the matching session. Changing the board identifier or challenge, signing with a different key or replaying a proof after reconnect left the gate closed.

A successful write to RESPONSE.BIN only confirms submission. The board publishes its decision in STATUS.BIN. The agent logs acceptance or rejection when the receipt matches both the session challenge and the submitted signature. A stale or missing receipt leaves the outcome unknown. Host tests exercise both verdicts and the stale receipt case.

What did I learn?
The three input strings form one stored input sequence. Passing them as command line arguments can expose them in shell history and process listings. The configuration writer reads each line from STDIN (standard input) and suppresses terminal echo during interactive entry. A file used to supply those lines can still retain its own plaintext copy.

Hidden entry alone cannot protect flash. A plaintext record would expose all three strings to anyone able to read the chip. The writer therefore encrypts and authenticates the complete record with AES-GCM (Advanced Encryption Standard in Galois/Counter Mode) before writing it. Plaintext still exists in memory during entry and playback, and the receiving host can observe the emitted keystrokes.

Host logout and USB disconnect have different effects. An authorised board that stays powered and connected can open its next active window using its own timer. A reset or disconnect requires a fresh signature. With the user agent stopped and no other signer available, the board waits for a proof.

What is the security relevant takeaway?
The enrolled public key is itself a security decision. If someone could replace it in flash, the verifier would trust a different signer. The firmware authenticates the pairing record and the stored input sequence with AES-GCM and binds each record to its flash address. The secure build signs and encrypts the image. On a provisioned board the firmware reads its configuration key shares from OTP (one time programmable memory) and locks those pages after import. Development images embed a recoverable test key.

A copied host private key can still authorise a connection.

The local journal records pairing decisions. It cannot establish that a later activation occurred. Remote notifications and reactivation monitoring remain possible extensions.

Repository
RP2350 HID Security Lab on GitHub

Zephyr RTOS Threads and Mutex Lab (zephyr-lab)
What was the task?
Build a Zephyr RTOS application in C for the RP2350 microcontroller (Raspberry Pi Pico 2 W) in small steps, each adding a single kernel feature and making its effect visible on a USB serial console. So far: one thread that sleeps, two threads with different priorities and two threads sharing a counter protected by a mutex. Every experiment can also run in Zephyr's native_sim target, which runs the real kernel and scheduler as a Linux programme on simulated time, so timing experiments repeat exactly.

The goal is to understand how a real-time operating system decides which thread runs and how threads can share data without losing updates.

What did I observe?
k_msleep() blocks only the calling thread and USB keeps working. In hid-lab, without an RTOS, any blocking wait in the single main loop stalled USB.

Scheduling is strictly by priority. A thread that never sleeps starves every thread below it and k_yield() does not help, because it only gives way to threads of the same or higher priority. Running the main thread below the USB driver's thread kept the console alive during these experiments.

Two threads adding to one counter without a lock lost about 60 additions per second. With the gap between read and write reduced to a few instructions, nothing was lost: on a single core the other thread can only wake on a timer tick and the addition always finished before the next one. In a second setup, the two thread periods locked into step and hid the race completely. A small change to either period brought the losses back.

What did I learn?
An RTOS is not a separate programme. The kernel is compiled into the same image as the application, with only the features the build configuration enables. Threads and mutexes are reserved at build time, so creating them cannot fail at runtime.

A mutex only protects what happens between lock and unlock. Readers need the lock too, otherwise a snapshot of related values may not belong together. Keeping the data and its mutex private to one module, behind two functions, means no caller can forget the lock.

Zephyr's mutex temporarily raises a lower priority holder to the priority of the thread waiting for it. This priority inheritance prevents priority inversion, where a medium priority thread indirectly blocks a high priority one.

Compared with POSIX threads on Linux (the 42 project philosophers), the ideas carry over but the guarantees differ. Linux shares time fairly across several cores. Zephyr on this board runs one core with strict priorities, which makes timing predictable and starvation easy to cause.

What is the security relevant takeaway?
A race that does not show in testing has not gone away. Two of three experiments without a lock lost nothing, purely because of timing. Missing locks have to be found by reading the code, not by running it.

Lost updates become a security problem when the shared value is a security control. A failed attempt counter in an access control device that loses increments under concurrent access lets an attacker make more guesses than the limit allows.

Priority inversion is an availability problem: a critical thread can miss its deadline although nothing is wrong with it. Priority inheritance has to be chosen deliberately, because not every locking primitive provides it.

Repository
Zephyr Lab on GitHub

USB HID Input Simulation Lab (hid-lab)
What was the task?
Build firmware in C for a USB Human Interface Device (HID) on the RP2350 microcontroller (Raspberry Pi Pico 2 and Pico 2 W) that generates mouse movement, clicks, key presses, typing bursts, scrolling and window switching. Each activity is its own state machine with randomised, bounded intervals, and keyboard and mouse share a single USB interface using HID report IDs. The firmware runs as one non-blocking loop without an RTOS and stops after a configurable run time of 1 to 24 hours. On the Pico 2 W it also keeps a Wi-Fi connection, with the credentials stored in flash rather than in the firmware image.

The goal is controlled input generation for analysing how systems behave under synthetic USB HID event streams at both kernel input and application event levels.

What did I observe?
USB HID input is accepted by the operating system as a standard input source once a device is successfully enumerated and is processed through the kernel input subsystem without application layer authentication.

A HID report carries the device's whole current state, not a single event. A mouse movement report sent during a click hold states that no button is pressed, so the host ends the click. Keyboard and mouse can share one endpoint through report IDs, but each logical device still needs one owner for its report.

The USB endpoint holds one report at a time. If a send fails unnoticed and a release report is lost, the host keeps the key or button pressed.

Timing structure is the main signal available for classifying an input stream. Fixed intervals are easy to identify as synthetic. Whether bounded random intervals resemble human input has not been measured yet; a ground-truth activity log from the device is planned for that comparison.

What did I learn?
Correct emulation requires explicit modelling of state transitions from press to hold to release rather than emitting isolated events. In hid-lab, tasks only edit a shared mouse state and a single function transmits it, and every state machine advances only once its report has been queued.

Without an operating system, any blocking wait stalls USB. All timing is therefore non-blocking, including the Wi-Fi connection, which is serviced from the same loop with no background thread or interrupt.

A 32-bit millisecond clock wraps after 49.7 days. Subtraction stays correct across one wrap, but elapsed time restarts from zero, which would have restarted a finished run. The fix latches expiry, and a test build that moves the start time forward proved it on hardware in 10 minutes instead of 49.7 days.

The default Release build removes assert(), so checks written that way do not exist in the flashed image. hid-lab uses its own assertion, which stays in the image and halts the firmware.

The flash layout is defined in two places, the build system and a shared header. Build-time checks now fail the build if the firmware could overlap the reserved configuration and credentials sectors.

Secrets compiled into firmware leak with every shared image. Moving the Wi-Fi credentials into their own flash sector, written once per board and checked with a CRC-32, removed them from the image. They are still plaintext in flash.

What is the security relevant takeaway?
USB HID is a low friction input channel with no intrinsic authentication mechanism after successful device enumeration, making it a high impact interface for both automation and input injection scenarios.

Vendor and product IDs are claims, not identity. hid-lab currently reports a Raspberry Pi product ID that belongs to another device, so allowlisting by vendor and product ID alone cannot tell a genuine device from firmware that copies its IDs.

Detection of synthetic input relies on aggregate behavioural signals rather than single events, including timing regularity, interaction density and the absence of corrective or exploratory user behaviour.

From a defensive perspective, correlating USB device enumeration events with subsequent input behaviour gives more context than classifying each input event on its own. Trust in input devices is implicitly granted at the hardware abstraction layer, which limits the effectiveness of user space only validation models.

Physical access defeats credentials stored on a device. Keeping them out of the firmware image protects shared builds, but anyone holding the board can still read its flash.

Repository
github.com/daniel-ploetzl/hid-lab

Runtime Isolation and Persistence Boundary Lab
(ram-workspace-lab)
What was the task?
Build a lab that relocates a complete user workspace into RAM and enforces an explicit persistence boundary using encrypted storage. The system should execute entirely from /dev/shm, isolate runtime state from disk and only persist data through a controlled commit operation.

The goal was to analyse how execution context (memory vs disk) affects system visibility, how runtime and persistent state can be separated and how explicit persistence changes the observability of user activity.

What did I observe?
Relocating $HOME to /dev/shm cleanly shifts all user activity into volatile memory, with no inherent dependency on disk-backed storage during runtime.

From the kernel and process perspective, applications behave identically regardless of whether their working directory resides in memory or on disk.

File-based artefacts are absent during execution, but reappear instantly once the workspace is repacked and written back to persistent storage.

Environment manipulation (overriding HOME and XDG_CONFIG_HOME) is sufficient to redirect most user-space behaviour without requiring deeper isolation mechanisms.

The commit phase becomes a clearly defined transition point where transient state is converted into persistent artefacts, making persistence an explicit and observable operation.

What I learned?
Execution context in Linux is largely independent of storage location, but strongly influences where observable artefacts are generated.

Separating runtime and persistence introduces a controllable boundary that allows precise reasoning about when and how data becomes durable.

Default system behaviour implicitly persists state, whereas explicit commit models require deliberate handling of inclusion, exclusion and failure conditions.

Configuration files such as .rwsignore form part of the execution contract and must remain external, immutable inputs to avoid unintended side effects.

Reliable persistence requires a transactional approach: intermediate failures must not destroy runtime state and cleanup must only occur after successful completion.

What is the security-relevant takeaway?
Execution from volatile memory reduces filesystem-based visibility during runtime, but does not eliminate observability at the process or memory level.

Delaying persistence shifts detection opportunities from static file inspection to temporal analysis of execution phases and commit events.

Explicit persistence boundaries demonstrate that data durability is not inherent to execution, but a consequence of controlled write operations.

Monitoring approaches that rely solely on filesystem artefacts will miss activity occurring entirely in memory-backed environments.

Effective analysis requires correlating runtime behaviour with persistence events, rather than treating disk state as the primary source of truth.

Repository
github.com/daniel-ploetzl/ram-workspace-lab

X11 Session Behaviour & Input Capture Lab (x11-lab)
What was the task?
Build a user-space X11 application that creates a fullscreen black window, completely captures all keyboard and mouse input, hides the cursor and blocks user interaction for a defined duration. After a configurable runtime, the program terminates all user processes via a signal-based mechanism.

The objective was to analyse how input control, focus and process termination can be enforced purely from user space using X11 primitives, without requiring elevated privileges.

What did I observe?
X11 allows a client to fully take over user interaction by combining an override-redirect window with input grabbing. The window manager is bypassed entirely, meaning the fullscreen window cannot be managed, minimised or overridden by normal desktop controls.

Grabbing the keyboard and pointer ensures that all input events are redirected exclusively to the created window. Other applications no longer receive input, effectively locking the user session at the display level.

The use of an invisible cursor removes visual feedback, reinforcing the perception of a frozen or blocked system. Despite this, the X server continues to process events normally in the background.

The event loop remains active and responsive, handling motion and key events while resetting the screensaver. This prevents the system from entering power-saving states during the lock period.

Process termination using kill(-1, SIGKILL) operates independently of X11 and targets all processes within the same process group or user context, providing a hard stop mechanism triggered by a timer.

What I learned?
X11 provides powerful primitives for controlling input and display state entirely from user space. Window manager bypass (override_redirect) combined with input grabs enables complete session takeover without requiring elevated privileges.

Input control in X11 is cooperative rather than enforced by strict isolation. A single client can monopolise input devices if it successfully acquires the necessary grabs.

Visual state (window content, cursor visibility) and input state (keyboard/mouse focus) are independent but can be combined to create strong control over user perception and interaction.

The system remains event-driven throughout: even in a “locked” state, the X server continues dispatching events and the client must explicitly handle or ignore them.

What is the security-relevant takeaway?
X11 allows any authorised client to capture global input and render fullscreen content without user consent, enabling effective denial-of-interaction scenarios entirely from user space.

Because input grabbing is not strongly restricted, a malicious or misconfigured application can prevent all other applications from receiving input, effectively locking the session.

The combination of input capture and process termination demonstrates that significant control over a user session can be achieved without kernel exploits or elevated privileges, relying solely on standard X11 and POSIX mechanisms.

Detection and prevention must therefore focus on restricting access to the X server and monitoring abnormal client behaviour, rather than relying on application-level safeguards.

This reinforces a fundamental limitation of X11: trust is granted at the client level and once connected, a process can exert extensive control over input and display state.

Repository
github.com/daniel-ploetzl/x11-lab

TryHackMe - Pentesting Fundamentals
What was the task?
Complete TryHackMe's "Pentesting Fundamentals" room. This is a foundational module covering penetration testing methodologies, legal and ethical frameworks, rules of engagement, and testing scopes (black box, grey box, white box).

What did I observe?
All penetration testing methodologies follow a general pattern: information gathering, enumeration and scanning, exploitation, privilege escalation, and post exploitation. The room covered several industry frameworks, each with different strengths and target domains. OSSTMM (Open Source Security Testing Methodology Manual) focuses on telecommunications and wired/wireless networks. OWASP (Open Web Application Security Project) specialises in web application security. NIST CSF (National Institute of Standards and Technology Cybersecurity Framework) provides standards for critical infrastructure and commercial organisations. NCSC CAF (National Cyber Security Centre Cyber Assessment Framework) applies to organisations performing vitally important services.

The legal foundation for pentesting is simple. Anything within the signed Rules of Engagement (RoE) is authorised, anything outside it is unauthorised access. The RoE document has three sections: Permission (explicit authorisation), Test Scope (which systems are in scope), and Rules (which techniques are permitted). Testing approach depends on how much information is provided. Black box testing (no internal knowledge), grey box testing (limited knowledge) or white box testing (full access to source code and architecture). Grey box is the most common in real engagements because it balances realism with efficiency.

What I learned?
The difference between legal and illegal testing is documentation. Without a signed RoE, the same actions constitute unauthorised access. Penetration testing is an authorised simulation of attacks. The methodology mirrors what an attacker would do, but under contract. Industry frameworks exist to standardise testing processes, but none are universal. OWASP focuses on web applications, OSSTMM on telecommunications and networks, NCSC CAF on critical infrastructure. Choosing the right framework depends on what is being tested. Black box testing takes significantly longer because of the information gathering phase, but it simulates an external attacker's perspective. White box testing is comprehensive but time intensive and typically performed by developers, not external testers. Grey box strikes a balance. Enough information to be efficient, but still testing from an attacker's viewpoint.

Security-relevant takeaway?
Understanding penetration testing methodologies is essential for offensive as well as defensive cybersecurity practitioners. The same stages an attacker follows (reconnaissance, scanning, exploitation, escalation) are what SOC operations should be monitoring for. Defensive detection requires understanding offensive methodology. The distinction between authorised and unauthorised testing also clarifies why some security research is legal and some is criminal. The difference is the contract, not the technique.

Platform
tryhackme.com/room/pentestingfundamentals

Linux Process Behaviour and Ephemeral Execution Lab (proc-lab)
What was the task?
Build a user-space Linux process lifecycle lab that explores transient execution, process isolation and controlled runtime behaviour using Bash. The system should migrate itself into volatile memory, detach from the terminal and execute a rotating payload process with bounded runtime and non-deterministic timing.

The goal was to analyse how processes behave when executed from ephemeral locations, how lifecycle control can be enforced at the process group level, and how observable patterns emerge from short-lived execution chains.

What did I observe?
Processes executed from /dev/shm behave identically to disk-backed binaries from the kernel perspective, but leave minimal persistent artefacts once removed.

Detaching via nohup and setsid cleanly separates execution from the parent shell, creating independent process groups that persist beyond session termination.

Rotating payload execution with short overlap windows creates continuous activity while avoiding a single long-lived process, resulting in fragmented but sustained behaviour.

Process group termination using negative PIDs reliably scopes signals to only the intended execution chain, preventing unintended impact on unrelated processes.

What I learned?
Process lifecycle control in Linux is fundamentally tied to process groups and session management rather than individual PIDs.

Ephemeral execution does not imply invisibility, but shifts observability towards runtime signals such as process creation frequency, naming patterns and execution paths.

Introducing bounded randomness in timing produces more realistic and less deterministic behaviour compared to fixed intervals.

Reliable cleanup requires explicit tracking of created artefacts rather than relying on pattern-based deletion.

Monitoring must operate independently of the execution context to provide an accurate external view of system behaviour.

What is the security-relevant takeaway?
Ephemeral execution in volatile memory combined with self-replication and rapid lifecycle changes reduces forensic visibility at the filesystem level, shifting detection requirements toward process behaviour and system call monitoring.

Process group signalling and /proc-based observation remain the primary reliable sources of truth in such environments, but are limited by timing granularity and sampling delay.

This demonstrates that security monitoring based solely on file artifacts or static process snapshots is insufficient in environments where execution is transient, overlapping and memory-resident.

Effective detection requires continuous correlation of process creation, lifespan and termination patterns rather than isolated inspection of individual process states.

Repository
github.com/daniel-ploetzl/proc-lab

TryHackMe - Introduction to Detection Engineering
What was the task?
Complete TryHackMe's "Introduction to Detection Engineering" room covering detection types, the detection engineering lifecycle, key frameworks (MITRE ATT&CK, Alerting and Detection Strategy (ADS), Detection Maturity Level (DML)), and applying the ADS Framework to an Active Directory privilege escalation detection scenario.

What did I observe?
Detection engineering operates on four detection types across two categories: Environment-based (Configuration and Modelling) and Threat-based (Indicator and Threat Behaviour). Configuration detection is easiest to implement in static environments but breaks in dynamic infrastructure. Indicator-based detection (Indicators of Compromise (IOCs), IP lists) is fastest to deploy but becomes obsolete as adversaries change infrastructure. Threat behaviour detection focuses on Tactics, Techniques and Procedures (TTPs) and withstands adversary evolution but requires extensive baseline data.

The Detection as Code approach treats detection rules like software with version control and Continuous Integration/Continuous Deployment (CI/CD) pipelines. Most Security Information and Event Management (SIEM) systems lack native version control for detection rules, which means changes are untracked and difficult to audit.

The ADS Framework mandates nine stages before production deployment: Goal, Categorisation, Strategy Abstract, Technical Context, Blind Spots & Assumptions, False Positives, Validation, Priority, Response. The Validation stage requires maintaining test scripts that generate true-positive events alongside detection rules.

Ryan Stillions' DML model shows most organisations operate at DML-1/DML-2 (atomic indicators and artifacts), which he describes as "chasing vapor trails". Higher maturity levels (DML-5+ for techniques, tactics, strategy) require progressively more contextual intelligence and abstraction.

The practical exercise demonstrated detecting unusual PowerShell host processes by monitoring for system.management.automation.dll loading into non-standard processes, a common Operational Security (OPSEC)-friendly technique adversaries use to avoid detection.

What I learned?
Detection engineering is continuous iteration, not one-time rule deployment. Rules must be modified as attack vectors and environments change. Combining detection types creates stronger coverage than relying on a single approach, e.g., pairing baseline modelling with configuration detection reduces false positives.

The ADS Framework forces you to think through the entire detection lifecycle before writing rules. The "Blind Spots & Assumptions" stage is counterintuitive but critical: explicitly documenting where your detection can fail enables risk assessment and compensating controls. For the PowerShell example, assumptions included endpoint tools running correctly, logs being forwarded and SIEM indexing successfully.

Validation is non-negotiable. Every detection should have accompanying test commands that generate true-positive events. Without this, you're deploying unverified rules into production.

The DML model revealed that most organisational resources concentrate on IOC feeds (DML-1), which are retroactive and adversary rate-of-change dependent. Moving toward behaviour-based detection (DML-5+) provides better Return on investment (ROI) but requires baseline data and more implementation effort.

Detection as Code (DaC) solves SIEM limitations by treating rules as version-controlled code. Sigma rules are vendor-agnostic and deployable across multiple SIEMs, which enables code reusability across detections.

What is the security-relevant takeaway?
Indicator-based detection (IP lists, hash values) is reactive and short-lived. Adversaries change infrastructure faster than organisations update indicator feeds. Investing disproportionately in DML-1/DML-2 approaches creates a maturity gap where detection always lags behind adversary capabilities.

Behaviour-based detection targeting TTPs provides sustainable defensive advantage because adversaries cannot easily change tactics without significant operational cost (Pyramid of Pain principle). However, this requires accurate baselines and cross-departmental collaboration to define normal behaviour.

Before deploying any detection rule, complete the ADS Framework validation stage with executable test commands. Untested detections generate alert fatigue when false positives fire, or worse, fail silently when real threats occur. Maintain validation scripts alongside detection rules in version control.

Map detection gaps proactively using MITRE ATT&CK during threat modelling, not reactively after incidents. Identify which TTPs your environment is vulnerable to, determine required data sources, then assess collection coverage. Missing log sources create blind spots that adversaries can exploit.

Platform
tryhackme.com/room/introtodetectionengineering

TryHackMe - Intro to Logs
What was the task?
Complete TryHackMe's "Intro to Logs" room, a beginner module covering log types, formats, standards, collection, storage, retention, deletion and a hands-on exercise using rsyslog and Unix tools to collect, parse, consolidate and analyse logs from multiple sources.

What did I observe?
Logs from different sources come in incompatible formats, e.g. nginx uses Combined Log Format, syslog uses its own timestamping, and application logs use JSON or XML. Before any analysis is possible, these need to be normalised to a common timestamp format. The practical exercise used awk and sed to rewrite timestamps from each source into a sortable format, then sort and uniq to deduplicate.

Time synchronisation (NTP) is a prerequisite. Without it, correlating events across systems is unreliable. Log retention follows a Hot/Warm/Cold model: recent logs in fast-query storage, older logs in a data lake, archived logs in compressed cold storage. GDPR (General Data Protection Regulation) requires unnecessary data to be removed, but deletions must be deliberate and auditable, with backups taken where retention is legally required. rsyslog can be configured per-service (e.g. isolating all sshd messages to a dedicated file) with a single config file in /etc/rsyslog.d/.

What I learned?
Centralisation is not optional. Without it, attack timelines cannot be reconstructed across systems. Parsing and normalisation are required before any analysis, as raw logs from heterogeneous sources are not directly comparable.

A single awk pipeline can normalise, extract, and reformat logs, but the logic differs per source format and must be written individually. Filtering after consolidation (e.g. by IP) is an effective way to reduce scope and focus on relevant events.
Log integrity matters: taking a hash (sha256sum) during collection is required if logs may later be used as evidence.

What is the security-relevant takeaway?
Effective detection depends on log collection working correctly before it depends on analysis tools. Missing centralisation, incorrect time synchronisation, or insufficient log retention silently break event correlation.

Log rotation is a security control, not housekeeping. Logs rotated too aggressively may remove data needed for investigation, while logs that are never rotated create availability and compliance risks. Retention policies must balance forensic needs, storage limits and European/national data protection requirements.

Platform
tryhackme.com/room/introtologs

Authentication Log Analysis Tool (soc-auth-triage)
What was the task?
Build a command-line tool to analyse system authentication logs and extract SSH-related authentication events. The script should identify failed login attempts, targeted usernames, time-based attack patterns and potential compromises by correlating failed logins with subsequent successful ones from the same source IP.

What did I observe?
On a production VPS, a small number of source IPs were responsible for the majority of failed login attempts, each registering hundreds of attempts within hours. The most targeted account was root, followed by common service accounts like mysql and backup.

Attack activity clustered in specific hours rather than being spread evenly, which is consistent with automated tools, not manual attempts. Modern Linux systems use RFC3339 timestamps and log Connection closed ... [preauth] instead of the traditional Failed password pattern. On some minimal cloud images, /var/log/auth.log doesn't exist at all and systemd logs only to journalctl.

What I learned?
Depending on configuration, systemd may log to files or to journalctl only. fail2ban blocks attempts before they appear as Failed password entries, so pattern matching must also handle Connection closed ... [preauth]. Correlating different event types (failed vs. successful) requires process substitution < <(...) to avoid subshell variable scope issues.

Key learning: In security log analysis, simple Unix tools (grep, awk, cut, sort, uniq) combined in clear pipelines are often more readable and maintainable than heavily complex regular expressions.

Beyond the technical implementation, I learned the importance of being explicit about assumptions when analysing logs. Log formats, available fields and even the presence of log files differ between systems, so tooling must fail safely and make its limitations visible rather than silently producing incomplete results. This reinforced that log analysis is less about writing clever parsing logic and more about systematically reducing uncertainty while avoiding false conclusions.

What is the security-relevant takeaway?
Automated scanning is constant background noise on any public-facing server. When reviewing authentication logs, the most relevant correlation to check first is whether repeated failed login attempts from the same source IP are later followed by a successful login, as this requires closer inspection.

Time-based clustering helps distinguish automated scanning from normal user behaviour. Repeated attempts against non-existent accounts usually indicate reconnaissance, where an attacker is testing which usernames exist before trying valid credentials.

Repository
github.com/daniel-ploetzl/soc-auth-triage