File size: 3,982 Bytes
5f02c05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Auth-log window labelling guide

You will label about 300 windows of real Loghub logs (200 OpenSSH, 100 Linux), each 5–20 consecutive lines. Every window gets **exactly one** label. Run:

```
python scripts/label_loghub.py --n 300
```

Each window is shown with the rule script's suggestion. Press Enter to accept it, or 1–7 to choose another label. Progress is saved after every answer, so you can quit (`q`) and resume at any time. Only line offsets and labels are saved (to `hades/evals/loghub_labels.jsonl`), never the log text.

## Labels

| # | Label | The window shows |
|---|---|---|
| 1 | `normal` | Only routine activity: accepted logins, sessions opening/closing, cron, successful sudo, connection housekeeping without failures |
| 2 | `failed_login` | Failed password attempts that don't match an attack pattern below: a few typos, or failures spread across sources with fewer than 6 from any one |
| 3 | `brute_force` | ≥ 6 failed passwords from **one source** against **≤ 3 accounts**, with no successful login from that source afterwards |
| 4 | `password_spray` | One source failing against **≥ 5 different existing accounts** (`Failed password for X`, not `for invalid user X`) |
| 5 | `invalid_user_scan` | ≥ 4 attempts on **non-existent accounts** (`Invalid user X`, `check pass; user unknown`) |
| 6 | `sudo_denied` | sudo refused: `user NOT in sudoers` or `incorrect password attempts` |
| 7 | `compromise` | A brute-force pattern **followed by a successful login from the same source** |

## Counting rules

- `message repeated N times: [ Failed password ... ]` counts as **N** failures.
- When a window has no `Failed password` lines (the Loghub Linux file), count `authentication failure; ... rhost=X` lines as failures from source X.
- `PAM N more authentication failures` is a summary of failures already logged; don't add it again.
- `input_userauth_request: invalid user X` repeats an `Invalid user X` line; count the pair once.
- `POSSIBLE BREAK-IN ATTEMPT!` (reverse-DNS mismatch) on its own is **not** a failure.

## When several labels apply

Use the first one that matches, in this order:
`compromise` → `brute_force` → `password_spray` → `invalid_user_scan` → `sudo_denied` → `failed_login` → `normal`.

## Judge the window, not the log around it

Label only what **these lines** show. The OpenSSH file comes from a server under constant attack, so many windows catch a few failures from an attack that clearly continues outside the window. Those are `failed_login` under the counts above, even though you can guess the bigger picture. The model only sees the window, and this keeps its labels and the rules' labels comparable.

## When unsure

Choose the **less severe** label (later in the priority list) and skip nothing. If a window is genuinely ambiguous (e.g. exactly 5 failures plus an unclear repeat line), pick the label the counting rules give and move on. Consistency matters more than any single window.

## Worked examples

**brute_force** (6 failures: 1 + "repeated 5 times"):
```
sshd[24200]: Failed password for root from 183.62.140.253 port 57120 ssh2
sshd[24200]: message repeated 5 times: [ Failed password for root from 183.62.140.253 port 57120 ssh2]
sshd[24200]: Disconnecting: Too many authentication failures for root [preauth]
```

**compromise**: six `Failed password for root from 1.2.3.4` lines, then `Accepted password for root from 1.2.3.4`.

**password_spray**: `Failed password for fztu|curi|zachary|webmaster1|jenkins from 183.62.140.253` (5 different existing accounts, one source).

**invalid_user_scan**: `Invalid user admin`, `Invalid user support`, `Invalid user 1234`, `Invalid user pi` (4 non-existent accounts).

**failed_login**: 3 failures for root from 183.62.140.253, nothing else suspicious (fewer than 6, so not brute force).

**normal**: `Received disconnect ... Bye Bye [preauth]`, `Connection closed by ... [preauth]`, `Accepted password for fztu`, session opened/closed.