It's Not the Tool — It's the Setup (And Who's Behind the Wheel)

Why true cybersecurity doesn't come from tools but from mastery, control, and a tuned setup — through the eyes of an engineer who prefers a V8 to AI.

May 07, 2025
Victor Nthuli
Security Best Practices
5 min read

Table of Contents

Loading...

It’s Not the Tool — It’s the Setup (And Who’s Behind the Wheel)

Security isn’t about having the most tools — it’s about knowing what happens when the tools fail.

The Obsession with Security Tools

When it comes to cybersecurity, people are obsessed with tools.

“What’s the best OSINT framework?” “Which EDR bypass script should I use?” “What’s the latest recon tool out there?”

But the truth is simple: It’s not about the tool — it’s about the setup and who’s driving it.

This fixation on tools creates a dangerous illusion - that security can be bought or downloaded rather than built and understood. The industry’s tool worship has created generations of “button pushers” rather than true security engineers.

Anyone can click ‘Scan’. But when things break — and they will — only mastery carries you through.

My Dream Car? RWD + V8, No Tech

Image As a car enthusiast, my dream setup is deliberately minimalist:

  • Rear-wheel drive - for direct control over power delivery
  • V8 engine - raw, predictable power with mechanical simplicity
  • Little to no electronics - no interference between input and output

Why? Because I want control, raw feedback, and no middleman between me and the machine.

Consider an older Corvette C5 versus a new computerized supercar. When the C5 starts to slide, you feel it instantly through mechanical feedback. There’s no stability control deciding what you “meant” to do. The response is immediate, honest, and depends entirely on your skill.

That’s exactly how I approach security tooling.

My Dream Security Setup: Clean, Lean, and Tuned

I don’t want tools that do everything for me — I want tools that expose the bare metal. A good security setup is like a track-tuned car:

Core System Architecture

  • Bare-bones Linux - I run Arch with a minimal window manager, no unnecessary services, and a meticulously curated package list. Each process has a purpose, each daemon is documented. Unlike bloated security distributions that offer “everything,” my system only runs what I explicitly allow.

Custom Development Approach

  • Custom scripts over frameworks - Instead of relying on Metasploit’s entire framework, I’ve built specialized Python modules that handle specific tasks. For instance, my reconnaissance pipeline is a series of chained Bash scripts that perform targeted enumeration without the noise of default Nmap scans.

Isolation Strategy

  • Minimal attack surface - My primary workstation has no listening ports except when explicitly needed. I use separate VMs for different client work, with strict network isolation. Defense begins with hardening yourself.

Comprehensive Telemetry

  • Logs, telemetry, and observability wired into every move - I run a local ELK stack that ingests not just system logs but custom events from my tools. Every scan, every connection, every significant action is logged with context, making pattern recognition immediate.

Example: The Power of Understanding Your Tools

Consider a simple port scan. Most security practitioners run:

nmap -sV -sC -p- 192.168.1.1

And wait for results. But do they understand what happens when those SYN packets hit the wire? When I need to scan a hardened target, I craft custom packets using Scapy with precise timing to avoid detection:

#!/usr/bin/env python3
"""
StealthScan - Advanced low-footprint TCP port scanner with customizable IDS evasion

This tool demonstrates how understanding the network stack allows for precise control
over packet crafting, timing, and evasion techniques beyond what commercial tools offer.
"""

from scapy.all import IP, TCP, ICMP, sr1, send, RandShort, conf
import random
import time
import argparse
import sys
import socket
import logging
import ipaddress
from concurrent.futures import ThreadPoolExecutor
from enum import Enum

# Configure logging
logging.basicConfig(format='%(levelname)s: %(message)s')
logger = logging.getLogger('StealthScan')

class ScanMode(Enum):
    """Scan modes with varying stealth levels"""
    QUICK = 'quick'       # Standard scan with minimal delay
    STEALTH = 'stealth'   # Randomized delays and TCP options
    PARANOID = 'paranoid' # Maximum evasion techniques

class PortState(Enum):
    """Port states as defined by traditional scanners"""
    OPEN = 'open'
    CLOSED = 'closed'
    FILTERED = 'filtered'
    UNFILTERED = 'unfiltered'  # Responds but unclear if open

class StealthScanner:
    """Advanced TCP scanner with customizable evasion techniques"""

    def __init__(self, target, ports, mode=ScanMode.STEALTH, 
                 timeout=2, ttl=None, fragments=False, 
                 source_ip=None, interface=None, threads=1,
                 randomize=True, banner=False, os_detect=False):
        """Initialize scanner with customizable parameters"""

        # Basic scan parameters
        self.target = target
        self.ports = ports
        self.mode = mode
        self.timeout = timeout
        self.results = {}
        self.threads = min(threads, 10)  # Limit max threads

        # Advanced options
        self.ttl = ttl
        self.fragments = fragments
        self.source_ip = source_ip
        self.interface = interface
        self.randomize = randomize
        self.banner = banner
        self.os_detect = os_detect

        # Configure Scapy settings
        if interface:
            conf.iface = interface
        if source_ip:
            conf.route.add(host=target, gw=source_ip)

        # Set network timing based on scan mode
        if self.mode == ScanMode.QUICK:
            self.min_delay, self.max_delay = 0.1, 0.3
        elif self.mode == ScanMode.STEALTH:
            self.min_delay, self.max_delay = 1.5, 3.8
        elif self.mode == ScanMode.PARANOID:
            self.min_delay, self.max_delay = 5.0, 15.0

        # Prepare port sequence
        if self.randomize:
            random.shuffle(self.ports)

    def _get_tcp_options(self):
        """Generate random TCP options to appear as different OS stacks"""
        # Common TCP options combinations for different OS signatures
        option_sets = [
            [('MSS', 1460), ('SAckOK', '')],                      # Windows-like
            [('MSS', 1400), ('WScale', 7), ('SAckOK', '')],       # Linux-like
            [('MSS', 1440), ('WScale', 6), ('SAckOK', '')],       # macOS-like
            [('MSS', 1460), ('WScale', 8), ('SAckOK', '')],       # BSD-like
            [('MSS', 1460), ('WScale', 2), ('Timestamp', (0,0))], # Router-like
        ]

        if self.mode == ScanMode.PARANOID:
            # In paranoid mode, create entirely random options
            mss = random.randint(1350, 1460)
            wscale = random.randint(0, 9)
            return [('MSS', mss), ('WScale', wscale), ('SAckOK', '')]
        else:
            return random.choice(option_sets)

    def _craft_packet(self, port):
        """Create a custom TCP packet with evasion techniques"""
        # Randomize source port for each scan
        sport = RandShort() if self.randomize else random.randint(1024, 65535)

        # IP layer customization
        ip_opts = {'dst': self.target}
        if self.ttl:
            ip_opts['ttl'] = self.ttl
        if self.source_ip:
            ip_opts['src'] = self.source_ip
        if self.fragments and self.mode == ScanMode.PARANOID:
            ip_opts['frag'] = 1

        ip_pkt = IP(**ip_opts)

        # TCP layer customization with pseudo-random seq number
        tcp_opts = {
            'sport': sport, 
            'dport': port, 
            'flags': 'S',  # SYN flag
            'seq': random.randint(1000, 900000),
            'window': random.choice([64240, 65535, 8192, 4096])  # Varies by OS
        }

        # Add TCP options based on mode
        if self.mode != ScanMode.QUICK:
            tcp_opts['options'] = self._get_tcp_options()

        tcp_pkt = TCP(**tcp_opts)

        return ip_pkt/tcp_pkt

    def _scan_port(self, port):
        """Scan a single port with appropriate evasion techniques"""
        try:
            # Randomized delay based on scan mode
            time.sleep(random.uniform(self.min_delay, self.max_delay))

            # Craft and send packet
            packet = self._craft_packet(port)
            response = sr1(packet, timeout=self.timeout, verbose=0)

            # Process response
            result = self._analyze_response(port, response)

            # Banner grabbing if enabled and port is open
            if self.banner and result['state'] == PortState.OPEN:
                banner = self._grab_banner(port)
                if banner:
                    result['banner'] = banner

            # Log result
            self._log_result(port, result)
            return result

        except Exception as e:
            logger.error(f"Error scanning port {port}: {e}")
            return {'port': port, 'state': PortState.FILTERED, 'error': str(e)}

    def _analyze_response(self, port, response):
        """Analyze packet response to determine port state"""
        result = {'port': port}

        if not response:
            result['state'] = PortState.FILTERED
            return result

        if response.haslayer(TCP):
            flags = response.getlayer(TCP).flags

            if flags & 0x12:  # SYN-ACK flags (0x12 = 0x02 | 0x10)
                # Send RST to tear down connection
                send(IP(dst=self.target)/TCP(
                    sport=response.dport, 
                    dport=response.sport, 
                    flags="R"), 
                    verbose=0
                )
                result['state'] = PortState.OPEN

                # Attempt OS fingerprinting if enabled
                if self.os_detect:
                    result['os_hints'] = self._fingerprint_os(response)

            elif flags & 0x14:  # RST-ACK flags
                result['state'] = PortState.CLOSED
            else:
                result['state'] = PortState.UNFILTERED
                result['flags'] = flags

        elif response.haslayer(ICMP):
            # ICMP error responses indicate filtered ports
            icmp_type = response.getlayer(ICMP).type
            icmp_code = response.getlayer(ICMP).code

            result['state'] = PortState.FILTERED
            result['icmp_type'] = icmp_type
            result['icmp_code'] = icmp_code

        return result

    def _fingerprint_os(self, packet):
        """Extract OS fingerprinting hints from response packets"""
        hints = []

        if packet.haslayer(TCP):
            tcp = packet.getlayer(TCP)

            # Check window size (often OS-specific)
            window = tcp.window
            if window == 65535:
                hints.append("Possibly FreeBSD/OpenBSD")
            elif window == 16384:
                hints.append("Possibly Linux 2.4/2.6")
            elif window == 8192:
                hints.append("Possibly Windows")
            elif window == 4096:
                hints.append("Possibly embedded device")

            # Check TTL for OS hints
            if packet.haslayer(IP):
                ttl = packet.getlayer(IP).ttl
                if 60 <= ttl <= 64:
                    hints.append("TTL suggests Linux/Unix/MacOS")
                elif 120 <= ttl <= 128:
                    hints.append("TTL suggests Windows")
                elif 240 <= ttl <= 255:
                    hints.append("TTL suggests Cisco/Network equipment")

        return hints

    def _grab_banner(self, port):
        """Attempt to grab service banner from open port"""
        common_ports = {
            21: "FTP", 
            22: "SSH", 
            25: "SMTP",
            80: "HTTP", 
            443: "HTTPS"
        }

        try:
            service = common_ports.get(port, "Unknown")

            # Simple socket connection for banner grabbing
            s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            s.settimeout(2)
            s.connect((self.target, port))

            # Send appropriate probe based on service
            if service == "HTTP":
                s.send(b"HEAD / HTTP/1.1\r\nHost: %s\r\n\r\n" % self.target.encode())
            elif service == "FTP":
                pass  # FTP servers send banner automatically
            elif service == "SMTP":
                pass  # SMTP servers send banner automatically

            # Receive response
            banner = s.recv(1024)
            s.close()

            # Clean and return banner
            if banner:
                return banner.strip().decode('utf-8', errors='ignore')

        except Exception:
            pass

        return None

    def _log_result(self, port, result):
        """Log scan results with appropriate verbosity"""
        state = result['state']

        if state == PortState.OPEN:
            logger.warning(f"[+] Port {port}: {state.value.upper()}")
            if 'banner' in result:
                logger.warning(f"    └─ Service: {result['banner']}")
            if 'os_hints' in result and result['os_hints']:
                logger.warning(f"    └─ OS Hints: {', '.join(result['os_hints'])}")
        elif state == PortState.CLOSED:
            logger.info(f"[-] Port {port}: {state.value}")
        else:
            logger.debug(f"[~] Port {port}: {state.value}")

        self.results[port] = result

    def scan(self):
        """Execute scan with configured parameters"""
        logger.warning(f"[*] Starting {self.mode.value} scan on {self.target}")
        logger.warning(f"[*] Scanning {len(self.ports)} ports with {self.threads} threads")

        start_time = time.time()

        # Create separate pool of workers based on thread count
        if self.threads > 1:
            with ThreadPoolExecutor(max_workers=self.threads) as executor:
                list(executor.map(self._scan_port, self.ports))
        else:
            # Single-threaded scanning for maximum stealth
            for port in self.ports:
                self._scan_port(port)

        # Scan summary
        open_ports = [p for p, r in self.results.items() if r['state'] == PortState.OPEN]
        scan_time = time.time() - start_time

        logger.warning(f"\n[*] Scan completed in {scan_time:.2f} seconds")
        logger.warning(f"[*] {len(open_ports)} open ports found out of {len(self.ports)} scanned")

        if open_ports:
            logger.warning("[*] Open ports: " + ", ".join(map(str, sorted(open_ports))))

        return self.results

def parse_port_range(port_str):
    """Parse comma-separated port ranges (e.g., '80,443,8000-8100')"""
    ports = []
    for item in port_str.split(','):
        if '-' in item:
            start, end = item.split('-')
            ports.extend(range(int(start), int(end) + 1))
        else:
            ports.append(int(item))
    return ports

def validate_ip(ip_str):
    """Validate IP address format"""
    try:
        ipaddress.ip_address(ip_str)
        return ip_str
    except ValueError:
        raise argparse.ArgumentTypeError(f"Invalid IP address: {ip_str}")

def parse_args():
    """Parse command line arguments with advanced options"""
    parser = argparse.ArgumentParser(
        description="StealthScan - Advanced TCP scanner with IDS evasion capabilities",
        epilog="Example: ./stealthscan.py -t 192.168.1.1 -p 22,80,443 -m stealth --banner"
    )

    # Required arguments
    parser.add_argument("--target", "-t", required=True, type=validate_ip,
                        help="Target IP address")
    parser.add_argument("--ports", "-p", required=True, 
                        help="Ports to scan (e.g., 22,80,443,8000-8100)")

    # Scan behavior
    parser.add_argument("--mode", "-m", choices=[m.value for m in ScanMode], 
                        default=ScanMode.STEALTH.value,
                        help="Scan mode (default: stealth)")
    parser.add_argument("--threads", type=int, default=1,
                        help="Number of parallel threads (default: 1, max: 10)")
    parser.add_argument("--timeout", type=float, default=2,
                        help="Packet timeout in seconds (default: 2)")
    parser.add_argument("--randomize", action="store_true",
                        help="Randomize port scanning order")

    # Advanced options
    parser.add_argument("--ttl", type=int, 
                        help="Custom TTL value for packets")
    parser.add_argument("--fragments", action="store_true",
                        help="Fragment packets (only in paranoid mode)")
    parser.add_argument("--source-ip", 
                        help="Spoof source IP address (requires appropriate routing)")
    parser.add_argument("--interface", "-i",
                        help="Network interface to use")
    parser.add_argument("--banner", action="store_true",
                        help="Attempt to grab service banners from open ports")
    parser.add_argument("--os-detect", action="store_true",
                        help="Attempt basic OS fingerprinting")

    # Verbosity
    parser.add_argument("--verbose", "-v", action="count", default=0,
                        help="Increase verbosity (can be used multiple times)")

    return parser.parse_args()

def main():
    """Main program entry point"""
    args = parse_args()

    # Set appropriate log level based on verbosity
    if args.verbose == 0:
        logger.setLevel(logging.WARNING)  # Default
    elif args.verbose == 1:
        logger.setLevel(logging.INFO)
    else:
        logger.setLevel(logging.DEBUG)

    try:
        # Parse port ranges
        ports = parse_port_range(args.ports)
        if not ports:
            logger.error("No valid ports specified")
            return 1

        # Initialize scanner with all options
        scanner = StealthScanner(
            target=args.target,
            ports=ports,
            mode=ScanMode(args.mode),
            timeout=args.timeout,
            threads=args.threads,
            ttl=args.ttl,
            fragments=args.fragments,
            source_ip=args.source_ip,
            interface=args.interface,
            randomize=args.randomize,
            banner=args.banner,
            os_detect=args.os_detect
        )

        # Run the scan
        scanner.scan()
        return 0

    except KeyboardInterrupt:
        logger.warning("\n[!] Scan interrupted by user")
        return 1
    except Exception as e:
        logger.error(f"[!] Error: {e}")
        return 1

if __name__ == "__main__":
    sys.exit(main())

This isn’t just about evading detection - it’s about truly understanding what happens at each layer of the network stack.

Real-World Lessons from Custom Scanning on Tailscale

I recently ran my custom scanner against my own Tailscale node to demonstrate how theoretical knowledge translates to practical security. The results were illuminating:

  • Stealth Mode: Reported four open ports.
  • Paranoid Mode: Reported zero open ports.
  • Nmap: Correctly identified all four open ports and their service versions.

This wasn’t a failure — it was a learning opportunity:

Why This Matters

  1. A security engineer blindly trusting the stealth scan → false positives.
  2. A security engineer relying on paranoid scan → critical services missed.
  3. Someone using only Nmap → accurate results but no protocol-level insight.

But the engineer who understands TCP/IP and evasion techniques can:

  • Diagnose discrepancies,
  • Identify scanner behavior under certain flag combinations,
  • Learn how timing affects detection reliability.

Takeaway

Building your own tools isn’t about outperforming Nmap —
it’s about learning the low-level behavior of packets and protocols.

Armed with this insight, I’m now improving my scanner to better handle edge cases — a step that enhances both offensive capabilities and defensive awareness.

Security Through Setup, Not Just Tools

You don’t need 50 GitHub scripts and 10 Docker containers to be secure. You need a tuned environment where:

Network Control

  • You control the network stack - I’ve modified my kernel’s TCP/IP stack parameters to optimize for security, not performance. This includes tweaking backlog queues, SYN cookie behavior, and connection timeouts.

System Understanding

  • You know what runs at startup - Every service on my system has been manually configured and reviewed. I don’t just know what runs at boot - I know why it needs to run, what it connects to, and what normal behavior looks like.

Anomaly Detection

  • You understand what normal looks like, so you can spot abnormal instantly - After weeks of baseline monitoring, I’ve established what my system’s “heartbeat” is. When memory usage spikes or network patterns change, I don’t need alerting tools to tell me - the deviation is immediately apparent.

Incident Response

  • You can script incident response in 5 lines or less - When I detect suspicious activity, I don’t fumble through GUI tools. I have pre-written response scripts that can isolate a system, capture volatile memory, and preserve evidence with a single command.

Real-World Example: Detecting the Undetectable

During a recent engagement, a client’s EDR solution missed a sophisticated attacker using fileless malware techniques. Their expensive security stack was blind to the threat. Using nothing but native Linux tools, I wrote a simple script that detected anomalous memory allocations:

#!/bin/bash
# Memory Anomaly Detector

# Use your actual directories
BASE_DIR="$HOME/socdev/scripts/memory_monitor"
BASELINE_DIR="$BASE_DIR/baselines"
CURRENT_DIR="$BASE_DIR/current"
DIFF_DIR="$BASE_DIR/diffs"
SCRIPTS_DIR="$BASE_DIR/scripts"
ALERT_THRESHOLD=3
LOG_FILE="$BASE_DIR/anomalies.log"

# Create required directories
mkdir -p "$BASELINE_DIR" "$CURRENT_DIR" "$DIFF_DIR" "$SCRIPTS_DIR"

# Create the memory diff analysis script if it doesn't exist
if [ ! -f "$SCRIPTS_DIR/memory_diff.py" ]; then
    cat > "$SCRIPTS_DIR/memory_diff.py" << 'EOF'
#!/usr/bin/env python3
"""
memory_diff.py - Analyzes memory maps for anomalies
Detects suspicious memory regions that could indicate fileless malware
"""
import sys
import re
import hashlib

def calculate_region_hash(region_data):
    """Calculate a hash for memory region data"""
    return hashlib.md5(region_data.encode()).hexdigest()

def parse_memory_map(filename):
    """Parse a memory map file into structured data"""
    regions = {}
    region_count = 0

    with open(filename, 'r') as f:
        for line in f:
            # Parse memory map line
            parts = line.strip().split()
            if len(parts) < 5:  # Skip malformed lines
                continue

            # Extract memory region address and permissions
            addr_range = parts[0]
            perms = parts[1]
            offset = parts[2]
            dev = parts[3]
            inode = parts[4]
            pathname = ' '.join(parts[5:]) if len(parts) > 5 else '[anonymous]'

            # Create a key that identifies this region
            region_key = f"{addr_range}_{perms}_{pathname}"
            region_hash = calculate_region_hash(line)

            regions[region_key] = {
                'addr_range': addr_range,
                'perms': perms,
                'offset': offset,
                'dev': dev,
                'inode': inode,
                'pathname': pathname,
                'hash': region_hash,
                'line': line.strip()
            }
            region_count += 1

    return regions, region_count

def analyze_differences(current_map, baseline_map):
    """Find suspicious differences between memory maps"""
    anomalies = []

    # Check for new executable regions
    for region_key, region in current_map.items():
        # Focus on executable regions
        if 'x' in region['perms']:
            # Look for regions not in baseline or with changed permissions
            if region_key not in baseline_map:
                anomalies.append({
                    'type': 'new_executable_region',
                    'region': region
                })
            elif region['hash'] != baseline_map[region_key]['hash']:
                anomalies.append({
                    'type': 'modified_executable_region',
                    'region': region,
                    'baseline': baseline_map[region_key]
                })

    # Look for suspicious anonymous executable memory
    for region_key, region in current_map.items():
        if 'x' in region['perms'] and region['pathname'] == '[anonymous]':
            # Anonymous executable memory is often used by malware
            if region_key not in baseline_map:
                anomalies.append({
                    'type': 'suspicious_anonymous_executable',
                    'region': region
                })

    # Check for abnormal memory permissions (writable+executable)
    for region_key, region in current_map.items():
        if 'w' in region['perms'] and 'x' in region['perms']:
            # W+X memory is a red flag
            anomalies.append({
                'type': 'writable_executable_memory',
                'region': region
            })

    return anomalies

def main():
    if len(sys.argv) != 3:
        print("Usage: memory_diff.py <current_map> <baseline_map>")
        sys.exit(1)

    current_file = sys.argv[1]
    baseline_file = sys.argv[2]

    try:
        current_map, current_count = parse_memory_map(current_file)
        baseline_map, baseline_count = parse_memory_map(baseline_file)

        anomalies = analyze_differences(current_map, baseline_map)

        # Print just the count for the bash script
        print(len(anomalies))

        # Detailed output to stderr for logging
        if anomalies:
            for anomaly in anomalies:
                print(f"ANOMALY: {anomaly['type']} - {anomaly['region']['addr_range']} {anomaly['region']['perms']} {anomaly['region']['pathname']}", file=sys.stderr)

    except Exception as e:
        print(f"Error: {e}", file=sys.stderr)
        print("0")  # Return 0 anomalies on error

if __name__ == "__main__":
    main()
EOF

    chmod +x "$SCRIPTS_DIR/memory_diff.py"
    echo "Created memory difference analysis script"
fi

# Function to capture current timestamp
timestamp() {
    date "+%Y-%m-%d %H:%M:%S"
}

# Function to log messages
log_message() {
    echo "$(timestamp) - $1" | tee -a "$LOG_FILE"
}

log_message "Starting memory anomaly detection scan"

# Collect current memory maps for all accessible processes
log_message "Collecting current memory maps..."
count=0
for proc in $(ps -eo pid --no-headers); do
    if [ -r /proc/$proc/maps ]; then
        cat /proc/$proc/maps > "$CURRENT_DIR/$proc.map"
        count=$((count + 1))
    fi
done
log_message "Collected memory maps for $count processes"

# Create baseline if it doesn't exist
if [ ! "$(ls -A "$BASELINE_DIR")" ]; then
    log_message "No baseline found. Creating initial baseline..."
    cp "$CURRENT_DIR"/* "$BASELINE_DIR"/
    log_message "Baseline created. Run the script again later to detect changes."
    exit 0
fi

# Compare current maps to baseline
log_message "Comparing to baseline..."
anomaly_count=0
total_processes=0

for file in "$CURRENT_DIR"/*.map; do
    proc_id=$(basename "$file" .map)
    baseline_file="$BASELINE_DIR/$(basename "$file")"

    if [ -f "$baseline_file" ]; then
        total_processes=$((total_processes + 1))
        anomalies=$("$SCRIPTS_DIR/memory_diff.py" "$file" "$baseline_file" 2>"$DIFF_DIR/$proc_id.diff")

        if [ "$anomalies" -gt "$ALERT_THRESHOLD" ]; then
            anomaly_count=$((anomaly_count + 1))
            log_message "ALERT: Process $proc_id ($(ps -p "$proc_id" -o comm= 2>/dev/null || echo "unknown")) has $anomalies memory region anomalies"

            # Additional information about the process
            ps -p "$proc_id" -f >> "$LOG_FILE" 2>/dev/null

            # Save detailed diff for further analysis
            echo "Process $proc_id anomalies:" >> "$LOG_FILE"
            cat "$DIFF_DIR/$proc_id.diff" >> "$LOG_FILE"
            echo "---------------------------------" >> "$LOG_FILE"
        fi
    else
        # New process not in baseline
        log_message "New process detected: $proc_id ($(ps -p "$proc_id" -o comm= 2>/dev/null || echo "unknown"))"
    fi
done

# Summary
if [ "$anomaly_count" -gt 0 ]; then
    log_message "Scan complete. Found $anomaly_count processes with significant memory anomalies out of $total_processes checked."
    log_message "Detailed logs saved to $LOG_FILE"
    log_message "Run this tool regularly to maintain an updated baseline and detect potential fileless malware."
else
    log_message "Scan complete. No significant memory anomalies detected in $total_processes processes."
fi

# Option to update baseline
echo
echo "Would you like to update the baseline with current memory maps? (y/N)"
read -r update_baseline

if [[ "$update_baseline" =~ ^[Yy]$ ]]; then
    cp "$CURRENT_DIR"/* "$BASELINE_DIR"/
    log_message "Baseline updated with current memory maps"
fi

This rudimentary script caught what a million-dollar security solution missed - because I understood the system at a fundamental level rather than trusting vendor marketing.

Memory Analysis in Practice

When I ran my custom memory anomaly detector on my workstation, it immediately identified 13 processes with significant memory layout changes.

Most of these anomalies came from Firefox’s content isolation processes (Isolated Web Co), which regularly change their memory regions while executing web content — a feature, not a flaw. Other alerts involved system components like kworker and sudo.

This level of raw visibility is precisely what many commercial security tools abstract away — either hiding it behind dashboards or dismissing it without context.


Why These Results Matter

This single test illustrates three powerful security principles:

  • Baselines are everything
    Understanding what memory regions normally look like in browser processes helped me quickly differentiate between JavaScript activity and potential exploitation.

  • Tools must adapt to context
    The 13 alerts weren’t false positives — they were real memory layout changes. What mattered was how I interpreted them, not just that they happened.

  • Security is an evolving process
    After the scan, I updated my baseline — reinforcing that visibility must be maintained, not just achieved once.


Comparing With Commercial EDR Tools

Let’s contrast this with a typical Endpoint Detection and Response (EDR) solution:

  • A commercial tool might have ignored these events entirely unless matched against a known signature.
  • Or it might have generated 13 noisy alerts, leaving you to guess which were serious.

Meanwhile, my 100-line Bash script offered:

  • Immediate, actionable insights
  • Full control over what counts as “normal”
  • A customizable foundation to improve over time

This is what I call the “bare metal” approach to security: don’t wait for alerts — understand the system itself.

Hacking Isn’t Magic — It’s Muscle Memory

Just like drifting a manual RWD car takes muscle memory and timing, real hacking isn’t about clicking through tools. It’s about knowing:

  • When to pivot from recon to exploitation - Experienced security engineers recognize exploitation paths from subtle reconnaissance findings. It’s not about running all possible scans; it’s about interpreting results and shifting tactics based on emerging information.

  • How to write your own payload when MSF fails - When facing custom environments, pre-built exploits often fail. I’ve had to modify shellcode on the fly to bypass specific security controls, adjusting encoding schemes and memory offsets based on target analysis.

  • How to exfiltrate without touching disk - During red team exercises, I’ve extracted sensitive data by encoding it into DNS queries, effectively bypassing content filters by using memory-only techniques and legitimate protocols.

  • How to stay invisible in an EDR world - Modern endpoint protection requires sophisticated evasion. I’ve developed techniques to execute critical code by hijacking legitimate process memory space, leaving no new processes for EDR to detect.

That doesn’t come from flashy tools. It comes from building your own setup — and mastering it through thousands of hours of deliberate practice.

The Skill Gap: Tool Users vs. Tool Builders

The security industry has two tiers: those who use tools and those who understand them deeply enough to build or modify them.

Real-World Personas

Tool User:

  • Relies on Burp Suite’s default scan profile
  • Runs same scans regardless of target environment
  • Presents vulnerability findings without context
  • Stumbles when default tools fail

Tool Builder:

  • Writes custom Burp extensions to manipulate response chains mid-flight
  • Tailors assessment methodology to each unique environment
  • Creates targeted exploits that prove business impact
  • Can switch approaches seamlessly when obstacles arise

Consider their approaches to vulnerability assessment:

Tool User: Runs Nessus scan → Gets 500 findings → Presents report with all vulnerabilities

Tool Builder: Understands the target architecture → Crafts specific tests for that environment → Validates findings manually → Presents contextualized risks with custom proof-of-concept

The difference isn’t in the initial capability - it’s in the depth of understanding that allows for adaptation when standard approaches fail.

Key Takeaways

  • Tools don’t make you secure — understanding does
  • Minimal setups = fewer blind spots
  • Build your stack, don’t borrow it
  • Mastery beats automation when tools inevitably fail
  • The ability to adapt is more valuable than any single tool

Final Thoughts: Control Is the Ultimate Security Layer

In a world where convenience is the enemy of control, a security-focused setup is a rebellion.

I don’t want automation that thinks for me. I want a keyboard, a terminal, a few choice binaries — and full control over every packet, every syscall, every keystroke.

Because in the end?

The best tool is the one you fully understand — and can fully trust.

The security practitioners I respect most don’t chase the latest tools - they invest in understanding the fundamentals so deeply that they could rebuild their toolkit if needed. They maintain the mechanical sympathy that comes from working close to the metal, where security truly lives.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” — Antoine de Saint-Exupéry

If your setup disappeared today, could you rebuild it from memory? If not — start tuning, not collecting.

Tags

Security Cybersecurity Information Security

Victor Nthuli

Security Operations Engineer specializing in incident response, threat hunting, and compliance alignment for regulated industries.

Related Posts

May 05, 2025

GTFObins in the wild

This blog explores the concept of GTFOBins—legitimate Unix binaries that attackers exploit for privilege escalation, persistence, and evasion on Linux systems. By demonstrating real-world abuse of common tools like less, vim, find, python, tar, and awk, the article shows how seemingly harmless utilities can be weaponized for post-exploitation. It also provides practical guidance on setting up a safe testing lab, along with robust defense strategies including auditing, access control, and network monitoring. Readers gain both offensive and defensive insights into one of the stealthiest techniques used in modern Linux attacks.

Read More
April 29, 2025

Nginx vs. HAProxy: Is It Time to Rethink Your Web Stack?

As HAProxy evolves beyond traditional load balancing into full HTTP proxy capabilities, many architects are questioning long-standing defaults like Nginx. This deep dive explores when to stay with Nginx, when to migrate to HAProxy, and how hybrid models are shaping the modern web.

Read More

Table of Contents

Loading...

Recent Posts

  • It's Not the Tool — It's the Setup (And Who's Behind the Wheel)

    May 07, 2025

    Current Post
  • GTFObins in the wild

    May 05, 2025

    Read Post
  • Nginx vs. HAProxy: Is It Time to Rethink Your Web Stack?

    April 29, 2025

    Read Post
  • Linux Server Hardening Guide: 15 Essential Commands for Stronger Security (Lynis, Monit, Fail2Ban)

    April 28, 2025

    Read Post
  • My Terminal is My Happy Place: A Tour of My CLI Setup

    April 22, 2025

    Read Post
  • Comprehensive Network Traffic Monitoring: A Deep Dive into Zeek, MySQL, and Grafana Integration

    April 19, 2025

    Read Post
  • Bookmarklet Deep Dive: Harvest Every JavaScript URL on a Page with a Single Line

    April 10, 2025

    Read Post
  • Ultimate Command Arsenal: Master Wireshark, Linux, and Windows CLI

    April 07, 2025

    Read Post
  • ZeroDay Odyssey: A Cyberpunk Framework for Web Application Penetration Testing

    April 05, 2025

    Read Post
  • Mastering Cybersecurity: A Complete Roadmap from Beginner to Expert

    April 02, 2025

    Read Post
  • Responsible Disclosure: Browser DevTools and Direct File Access in SlidesGPT

    April 01, 2025

    Read Post
  • Bluewave vs Uptime Kuma: A Real-World Comparison for Monitoring Uptime and Beyond

    March 26, 2025

    Read Post
  • Nextcloud

    March 25, 2025

    Read Post
  • 🔍 Keeping Your Linux Services in Check: How I Use Monit for Bulletproof Monitoring 🚨

    February 03, 2025

    Read Post

About the Author

Victor Nthuli is a Security Operations Engineer with expertise in incident response, SIEM implementation, and threat hunting. With a background in cybersecurity and a passion for Linux systems, he provides insights based on real-world experience.

Learn More

Subscribe for Security Updates

Get notified when new security articles and insights are published.

Need Enterprise Security Solutions?

Visit SocDev Africa for comprehensive security services and software development solutions for your organization.

Visit SocDev.Africa