TExcelTAD
Home › Security Projects, Study Plan, Certifications & Careers › Projects 1-2: A SOC Lab and a Detection Pack

Projects 1-2: A SOC Lab and a Detection Pack

The two defensive projects build the blue-team half of a portfolio. Project 1 is a working security operations lab: a SIEM collecting from Linux and Windows machines, detections that fire on activity you generate yourself, and an incident written up as a SOC would. Project 2 is a detection pack: a small, versioned set of YARA and Sigma rules with a test corpus that proves each rule fires on what it should and stays quiet on what it shouldn't. Both follow the common frame: written scope, deliverables, the five-criterion rubric.

Project 1: a SOC lab with Wazuh and detections

Goal. Build a small SOC in your lab, generate realistic activity, detect it, and handle one simulated incident from alert to report.

Builds on. Defensive Security: log sources, Sysmon and auditd, the brute-force-then-success detection, the Wazuh lab and its incident, triage; Network Security for the segmentation of the lab; Windows event IDs if you add a domain controller.

Scope. Lab machines only: siem.lab.test (10.10.0.50), web01.lab.test (10.10.0.10), optionally dc01.lab.test (10.10.0.20); activity generated by you from kali.lab.test with test accounts.

Steps (your route may differ).

  1. Install the SIEM and enrol two agents; prove collection works with a test event from each.
  2. Write a detection plan: five behaviours to detect (failed-login burst, success after failures, new privileged user, new service or scheduled task, a scan from inside the lab), each with its log source.
  3. Generate each behaviour from the lab, confirm the alert, record time to detect.
  4. Tune: generate normal activity for an hour and count false positives; adjust thresholds.
  5. Run one end-to-end incident: a password-guessing burst against web01 that succeeds with a weak lab password, followed by a new sudo user. Triage it, contain it (disable the account, block the source in the lab firewall), and write the incident report.

The heart of step 5 is a correlation: failures from one source, then a success, then a privileged change. Here it is on a synthetic SIEM export, the kind of check you would write to verify that the lab's rule fires on exactly this sequence:

python · try it yourself
import json
from datetime import datetime, timedelta

# Synthetic alerts as a SIEM exports them (one JSON object per line), from the lab SOC
EXPORT = """\
{"ts": "2026-01-15T10:00:05", "agent": "web01", "rule": "sshd: authentication failed", "level": 5, "srcip": "10.10.0.66", "user": "admin"}
{"ts": "2026-01-15T10:00:09", "agent": "web01", "rule": "sshd: authentication failed", "level": 5, "srcip": "10.10.0.66", "user": "admin"}
{"ts": "2026-01-15T10:00:14", "agent": "web01", "rule": "sshd: authentication failed", "level": 5, "srcip": "10.10.0.66", "user": "root"}
{"ts": "2026-01-15T10:00:20", "agent": "web01", "rule": "sshd: authentication failed", "level": 5, "srcip": "10.10.0.66", "user": "admin"}
{"ts": "2026-01-15T10:00:26", "agent": "web01", "rule": "sshd: authentication failed", "level": 5, "srcip": "10.10.0.66", "user": "admin"}
{"ts": "2026-01-15T10:00:31", "agent": "web01", "rule": "sshd: authentication success", "level": 3, "srcip": "10.10.0.66", "user": "admin"}
{"ts": "2026-01-15T10:02:10", "agent": "web01", "rule": "new user added to sudo group", "level": 8, "srcip": "", "user": "admin"}
{"ts": "2026-01-15T10:05:00", "agent": "dc01", "rule": "windows: logon failure", "level": 5, "srcip": "10.10.0.21", "user": "bob"}
{"ts": "2026-01-15T10:05:40", "agent": "dc01", "rule": "windows: logon success", "level": 3, "srcip": "10.10.0.21", "user": "bob"}"""

alerts = [json.loads(line) for line in EXPORT.splitlines()]
for a in alerts:
    a["ts"] = datetime.fromisoformat(a["ts"])

WINDOW, THRESHOLD = timedelta(minutes=10), 5
incidents = []
for a in alerts:
    if a["rule"].endswith("success"):
        fails = [f for f in alerts if f["srcip"] == a["srcip"] and f["agent"] == a["agent"]
                 and "fail" in f["rule"] and a["ts"] - WINDOW <= f["ts"] < a["ts"]]
        if len(fails) >= THRESHOLD:
            follow = [f for f in alerts if f["agent"] == a["agent"] and f["user"] == a["user"]
                      and f["level"] >= 8 and a["ts"] < f["ts"] <= a["ts"] + WINDOW]
            incidents.append((a, len(fails), follow))

print(f"{len(alerts)} alerts, {len(incidents)} incident(s)")
for a, n, follow in incidents:
    print(f"INCIDENT {a['agent']}: {n} failures then success for {a['user']} from {a['srcip']} at {a['ts']:%H:%M:%S}")
    for f in follow:
        print(f"  follow-up {f['ts']:%H:%M:%S} level {f['level']}: {f['rule']}")
9 alerts, 1 incident(s)
INCIDENT web01: 5 failures then success for admin from 10.10.0.66 at 10:00:31
  follow-up 10:02:10 level 8: new user added to sudo group

The burst from 10.10.0.66 (five failures in 21 seconds, then a success 5 seconds later) is an incident, and the sudo change 99 seconds later is its follow-up; bob's single failure and success on the domain controller is normal. In the lab, the same logic is a SIEM rule; the brute-force lab explores how window and threshold trade false positives against missed attacks:

failed ✕ and successful ● sign-ins over one hourbrute forcesprayadminalicebobcaroldaveerinfrankgraceheidiivanjudyken0 min10 min20 min30 min40 min50 min60 minalertsSAASalert on an attack (TP)false alarm (FP)A = per account, S = per sourceattacker failureuser typo / forgotten password

Deliverables. Lab diagram and the SIEM's configuration (no secrets); the detection plan with each rule and the log source it uses; evidence per detection (the activity, the alert, the time); false-positive counts before and after tuning; the incident report (timeline, scope, containment, eradication, lessons).

Rubric specifics. Detection is the heavy criterion here: 3 means every rule was triggered by a test and checked for false positives. Fix and retest: containment and the hardening that prevents a repeat (key-based SSH, lockout or rate limiting), then the same attack again showing it fails.

Stretch goal. Add a Windows domain controller with Sysmon and detect one technique from Windows & AD, such as a Kerberoasting request pattern on lab accounts (roasting); map all your rules to MITRE ATT&CK and show the coverage.

Project 2: a YARA and Sigma detection pack

Goal. Publish a small detection pack (5–10 rules) with tests, the way detection-engineering teams work: rules as code, a test corpus, and a check that runs on every change.

Builds on. YARA basics, YARA testing, Sigma rules, the Sigma evaluator, detection as code, testing detections.

Scope. Rules that match benign test material only: the EICAR test file, synthetic samples you write that imitate suspicious strings with an explicit LAB-SAMPLE-ONLY marker, and synthetic log events. No real malware is downloaded, stored or shared.

The core of the pack is the test harness. This session (in your sandbox, no network) writes two rules, a positive and a negative test corpus, and a loop that checks every file against its expectation. The first run catches a bug in a rule:

bash · try it yourself
mkdir -p pack tests/positive tests/negative
cat > pack/lab_rules.yar <<'YAR'
rule Lab_EICAR_Test_File
{
    meta:
        description = "EICAR anti-virus test file (harmless)"
    strings:
        $eicar = "EICAR-STANDARD-ANTIVIRUS-TEST-FILE!"
    condition:
        $eicar at 27 and filesize < 128
}

rule Lab_Fake_Dropper_Marker
{
    meta:
        description = "benign lab sample that imitates a dropper's strings"
    strings:
        $url  = "http://update.lab.test/payload.bin" ascii
        $run  = "Software\\Microsoft\\Windows\\CurrentVersion\\Run" ascii nocase
        $mark = "LAB-SAMPLE-ONLY" ascii
    condition:
        $mark and ($url or $run)
}
YAR
cp /opt/sec-samples/files/eicar.com tests/positive/
printf 'LAB-SAMPLE-ONLY\nfetch http://update.lab.test/payload.bin\n' > tests/positive/fake-dropper.txt
printf 'LAB-SAMPLE-ONLY\nthis lab note mentions nothing suspicious\n' > tests/negative/lab-note.txt
printf 'The EICAR-STANDARD-ANTIVIRUS-TEST-FILE! string, quoted in a report\n' > tests/negative/report.txt
cp /opt/sec-samples/files/hello.txt /opt/sec-samples/files/random.bin tests/negative/

run_tests() {
  fail=0
  for f in tests/positive/*; do
    [ "$(yara -c pack/lab_rules.yar "$f")" != 0 ] && echo "PASS hit  $f" || { echo "FAIL miss $f"; fail=$((fail+1)); }
  done
  for f in tests/negative/*; do
    [ "$(yara -c pack/lab_rules.yar "$f")" = 0 ] && echo "PASS none $f" || { echo "FAIL hit  $f"; fail=$((fail+1)); }
  done
  echo "failures: $fail"
}
run_tests
grep -ob 'EICAR-STANDARD' tests/positive/eicar.com
sed -i 's/\$eicar at 27/$eicar at 28/' pack/lab_rules.yar
echo "--- after the fix"
run_tests
yara -s pack/lab_rules.yar tests/positive/eicar.com
FAIL miss tests/positive/eicar.com
PASS hit  tests/positive/fake-dropper.txt
PASS none tests/negative/hello.txt
PASS none tests/negative/lab-note.txt
PASS none tests/negative/random.bin
PASS none tests/negative/report.txt
failures: 1
28:EICAR-STANDARD
--- after the fix
PASS hit  tests/positive/eicar.com
PASS hit  tests/positive/fake-dropper.txt
PASS none tests/negative/hello.txt
PASS none tests/negative/lab-note.txt
PASS none tests/negative/random.bin
PASS none tests/negative/report.txt
failures: 0
Lab_EICAR_Test_File tests/positive/eicar.com
0x1c:$eicar: EICAR-STANDARD-ANTIVIRUS-TEST-FILE!

The EICAR rule missed its own test file: the author counted the 27 bytes in front of the $ and forgot the $ itself, so the string really starts at byte 28 (grep -ob shows the offset, and yara -s confirms it as 0x1c). Without the harness, that rule would have shipped and never fired. Note also the two negative tests that earn their place: a report that quotes the EICAR string must not match (the at and filesize conditions see to that), and a lab note with the marker but nothing suspicious must not match either.

Deliverables. A repository with rules/ (YARA and Sigma), tests/positive/ and tests/negative/ per rule, synthetic log events for the Sigma rules, a test script that exits non-zero on any failure, and a README that states for each rule what it detects, its known false positives and its ATT&CK technique.

Rubric specifics. Technical work 3: every rule has at least one positive and one negative test, and the conditions are as narrow as the behaviour allows. Fix and retest here means rule fixes: every bug the harness found is recorded with its fix, as above.

Stretch goal. Run the harness in CI on every commit, and add a performance test: time the YARA pack over a large folder of benign files and flag rules that are slow (YARA warns about strings that slow scanning).

Pitfalls

  • Rules that only match the test file. A rule for a sample's exact hash or a single unique string detects that file, not the behaviour; aim higher up the pyramid of pain.
  • No negative tests. A rule that matches everything passes every positive test.
  • Real samples "for realism". They add nothing a synthetic sample with the same strings doesn't, and handling them safely is a project of its own (sample handling).

Practice

1. In the SIEM export, change the threshold to 6. What happens, and is that better?

No incident: there are exactly five failures before the success. The attack would be missed. A threshold has to be chosen from data, by generating attacks and normal activity in the lab, not by guessing; five failures in ten minutes followed by a success is a common starting point.

2. Write a negative test that would catch a version of the dropper rule whose condition is just $url or $run.

A benign file that mentions the Run key without the marker, for example a note Persistence is often under Software\Microsoft\Windows\CurrentVersion\Run. The marker-free version would match it; the pack's rule requires $mark and does not.

Test yourself

In the synthetic export, why is bob's activity on dc01 not an incident?

  1. Windows is not monitored
  2. One failure followed by a success is below the threshold of five failures
  3. bob is an administrator
  4. The source is outside the lab

What bug did the YARA test harness catch?

  1. A rule that matched everything
  2. The EICAR string's offset was 27 in the rule but 28 in the file
  3. YARA was not installed
  4. The negative tests were missing

Why does the pack include a report that quotes the EICAR string as a negative test?

  1. To test YARA's speed
  2. To make sure the rule matches the test file, not every document that mentions it
  3. Because EICAR is malware
  4. To check the file size limit only