# CDB lists in Wazuh: lookup attributes, built-in lists, API and an example

> Wazuh 4.14 CDB list attributes in rules, shipped lists, file management through the API and a full example: list file, ossec.conf, rule and logtest.

Published: 2026-11-12. Category: Detection. Tags: Wazuh 4. URL: https://wazuh.blog/en/blog/wazuh-cdb-lists/ Polish original: https://wazuh.blog/blog/wazuh-cdb-lists/

Wazuh rules can check against CDB lists whether a value extracted from an event is on a list of keys, and optionally compare the value assigned to the key with a regular expression. This post covers the attributes of the `<list>` element, the lists shipped with the ruleset, the API endpoints for managing files and a complete example from the file to the test result.

## What a CDB list is for

Wazuh can compare a field extracted during decoding with a CDB list, that is, a constant database. The rule syntax documentation describes it as a fast on-disk database that always finds a key in at most two seek operations on the file. Typical uses are lists of users, file hashes, IP addresses and domain names. The key is used to check whether a value is present or absent, and the optional value after the key is an additional rule criterion.

A list is neither a rule nor an alert. The rule must point to the list and to the field to check. The field comes from the decoder, so its name is set according to [custom decoders](/en/blog/wazuh-custom-decoders/) or the built-in decoders.

## File format

A list is a plain text file. Each line holds a unique key, the `:` separator and an optional value. Values can repeat, keys cannot.

```text
example-user-01:blocked
example-user-02:review
example-user-03:blocked
```

When the list is used only to check for the presence of a key, the part after the separator stays empty (`example-user-01:`). If a key contains a colon, for example a MAC address, the whole key is enclosed in quotes, and the separator that precedes the value comes after them.

```text
"a0:a0:a0:a0:a0:a0":
"b1:b1:b1:b1:b1:b1":
```

Wazuh recommends keeping lists in `/var/ossec/etc/lists`.

## Declaration in `ossec.conf`

A list is declared in the `<ruleset>` block of `/var/ossec/etc/ossec.conf`. The value is the relative path to the file without an extension. For the file `/var/ossec/etc/lists/example-users` the entry looks like this:

```xml
<ruleset>
  <list>etc/lists/example-users</list>
</ruleset>
```

Since Wazuh 3.11.0, lists are built and loaded automatically when the analysis engine starts. After you add or change a list, you must restart the manager:

```bash
systemctl restart wazuh-manager
```

On systems with SysV init the equivalent is `service wazuh-manager restart`. You add your own list next to the lists shipped with Wazuh, which the manager configuration template declares in the same block.

## Attributes of the `list` element in a rule

The `<list>` element in a rule takes three things: the list name as its content (a path relative to the Wazuh directory, the same as in `ossec.conf`), the `field` attribute and the `lookup` attribute. The `check_value` attribute works only with two `lookup` types.

| Attribute | Value | Meaning |
| --- | --- | --- |
| `field` | `srcip`, `srcport`, `dstip`, `dstport`, `extra_data`, `user`, `url`, `id`, `hostname`, `program_name`, `status`, `action` or a dynamic field | Event field used as the lookup key |
| `lookup` | `match_key` | Matches when the key is on the list; the default value |
| `lookup` | `not_match_key` | Matches when the key is not on the list |
| `lookup` | `match_key_value` | Looks up the key, and checks the value from the list with the expression from `check_value` |
| `lookup` | `address_match_key` | Looks up an IP address, matches when it is on the list |
| `lookup` | `not_address_match_key` | Matches when the IP address is not on the list |
| `lookup` | `address_match_key_value` | Looks up an IP address, and checks the value from the list with the expression from `check_value` |
| `check_value` | regular expression | Pattern for the value taken from the list, only for `match_key_value` and `address_match_key_value` |

For a field containing an IP address, the documentation requires the types with the `address_` prefix. Because `match_key` is the default, the two entries below are equivalent:

```xml
<list field="user" lookup="match_key">etc/lists/example-users</list>
<list field="user">etc/lists/example-users</list>
```

The variant with a value and the variant for addresses:

```xml
<list field="user" lookup="match_key_value" check_value="^blocked">etc/lists/example-users</list>
<list field="srcip" lookup="address_match_key_value" check_value="^reject">etc/lists/example-ip-values</list>
```

## IP addresses and prefix notation

To match a subnet, the documentation uses dotted notation. A key ending with a dot covers the whole range, a full address matches one host, and a key with two octets gives a `/16` range.

| Key | CIDR equivalent | Matched addresses |
| --- | --- | --- |
| `192.0.2.` | `192.0.2.0/24` | from `192.0.2.0` to `192.0.2.255` |
| `198.51.100.` | `198.51.100.0/24` | from `198.51.100.0` to `198.51.100.255` |
| `203.0.113.25` | `203.0.113.25/32` | only `203.0.113.25` |

The CIDR column describes the range that the key covers. In the list file you write the key from the first column:

```text
192.0.2.:
198.51.100.:
203.0.113.25:
```

## Lists shipped with the ruleset

The `ruleset/lists` directory in the Wazuh repository at version v4.14.0 contains the files below. In an installation they land in `etc/lists`.

| File | Content | Use in rules |
| --- | --- | --- |
| `audit-keys` | five keys `audit-wazuh-w`, `-r`, `-a`, `-x`, `-c` with the values `write`, `read`, `attribute`, `execute`, `command` | auditd rules with `match_key_value` on the `audit.key` field |
| `amazon/aws-eventnames` | CloudTrail event names with the service name as the value, for example `AttachLoadBalancers:Autoscaling` | the `aws.eventName` field with `match_key` in Amazon rules |
| `amazon/aws-sources` | only a comment that filtering by CloudTrail sources is no longer used | none |
| `security-eventchannel` | numeric keys, for example `200:` | mentioned in the sample `ruleset` block in the documentation |
| `malicious-ioc/malicious-ip` | IP addresses as keys without values | rules from `0999-malicious-ioc-rules.xml` |
| `malicious-ioc/malicious-domains` | domain names as keys | the same rules, fields `http.hostname` and `dns.rrname` |
| `malicious-ioc/malware-hashes` | SHA-256 hash and the family name after the colon | rule 99901 on the `sha256` field |

The rules in the file `0999-malicious-ioc-rules.xml` have identifiers in the range 99900 to 99999. Rule 99903 (level 14, `if_sid` 5715) checks `srcip` in `malicious-ioc/malicious-ip`, and 99904 (level 9, `if_sid` 5716) does the same for a failed sshd login. Both use `lookup="match_key"` for the IP address, even though the documentation requires `address_` types for IP fields. Recommendation: in your own rules, use the types as the documentation says.

The template `etc/ossec-server.conf` from v4.14.0 declares in `<ruleset>` the list `audit-keys` and three from the `malicious-ioc` directory.

## Managing files through the API

The Wazuh server API has three paths for lists. They require a JWT token, which you get the same way as for other API calls:

```bash
TOKEN=$(curl -u <WAZUH_API_USER>:<WAZUH_API_PASSWORD> -k -X POST "https://localhost:55000/security/user/authenticate?raw=true")
```

| Method and path | Action | RBAC permission |
| --- | --- | --- |
| `GET /lists` | List contents as `key` and `value` pairs with `relative_dirname` and `filename`; filters `relative_dirname`, `filename`, `search`, `q`, `select`, `sort`, `offset`, `limit`, `distinct` | `lists:read` |
| `GET /lists/files` | Paths of all list files relative to the installation directory | `lists:read` |
| `GET /lists/files/{filename}` | Content of one file; the `raw=true` parameter returns plain text | `lists:read` |
| `PUT /lists/files/{filename}` | Replaces or uploads a file; body as `application/octet-stream`, parameter `overwrite` (default `false`) | `lists:update`, `lists:delete` |
| `DELETE /lists/files/{filename}` | Deletes a file | `lists:delete` |

For `GET` and `DELETE` you give only the file name, and the API searches for it recursively. With `overwrite=false`, an attempt to write under the name of an existing file ends with an exception. Uploading a new list and replacing the content of an existing one:

```bash
curl -k -X PUT "https://localhost:55000/lists/files/example-ip?overwrite=true" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @example-ip
```

```bash
curl -k -X GET "https://localhost:55000/lists/files/example-ip?raw=true" \
  -H "Authorization: Bearer $TOKEN"
```

The response to a successful `PUT` carries the message `CDB list file uploaded successfully`. Uploading a file does not change the configuration: the list still has to be declared in `ossec.conf`, and a rule has to refer to it.

## Full example: a blocked subnet in SSH logins

The example uses only synthetic values. The rule reports a login attempt for a nonexistent account if the source address belongs to a subnet from the list. The built-in rule 5710 (`if_sid` 5700, pattern `illegal user|invalid user`) detects a login attempt for a nonexistent account, and the sshd decoder extracts the `srcip` field.

The file `/var/ossec/etc/lists/example-ip`:

```text
203.0.113.:
```

Declaration in the `<ruleset>` block of `/var/ossec/etc/ossec.conf`:

```xml
<ruleset>
  <list>etc/lists/example-ip</list>
</ruleset>
```

The rule in `/var/ossec/etc/rules/local_rules.xml`, with an identifier from 100000:

```xml
<group name="example-cdb,">
  <rule id="100010" level="10">
    <if_sid>5710</if_sid>
    <list field="srcip" lookup="address_match_key">etc/lists/example-ip</list>
    <description>sshd: invalid user from a listed example network $(srcip)</description>
  </rule>
</group>
```

After restarting the manager (`systemctl restart wazuh-manager`), you run `/var/ossec/bin/wazuh-logtest` and paste an event in the format from the logtest documentation. Using the tool is covered in the post on [wazuh-logtest](/en/blog/wazuh-logtest/).

```text
Nov 12 10:00:00 agent-01 sshd[29205]: Invalid user example-user-01 from 203.0.113.25 port 48928
```

Expected result, derived from the format described in the documentation (the event in the documentation gave `srcip`, `srcport` and `srcuser` in phase 2), with fields unrelated to the list left out:

```text
**Phase 3: Completed filtering (rules).
   id: '100010'
   level: '10'
   description: 'sshd: invalid user from a listed example network 203.0.113.25'
**Alert to be generated.
```

The same log with the address `192.0.2.50`, which is not on the list, should give rule 5710 at level 5, with no match for rule 100010. A level 10 alert can then be tied to an automatic response, which is covered in the post on [active response](/en/blog/wazuh-active-response/).

The hash variant comes from a use case in the documentation: rule 110002 (level 13) in `local_rules.xml` has `<if_sid>554, 550</if_sid>` and `<list field="md5" lookup="match_key">etc/lists/malware-hashes</list>`, so it matches the hash of a file detected by FIM. In this example the monitored directory has the setting `<directories check_all="yes" realtime="yes">`.

## Combining several lists in rules

The documentation shows separate rules that check an address against two lists, and a child rule that checks both. Each rule has one `<list>` element, and the combination is built through `if_sid`. The identifiers come from the documentation, the list and group names are examples.

```xml
<rule id="110700" level="10">
  <if_group>json</if_group>
  <list field="srcip" lookup="address_match_key">etc/lists/example-ip-one</list>
  <description>IP matches example list one</description>
  <group>example-list-one,</group>
</rule>

<rule id="110701" level="10">
  <if_group>json</if_group>
  <list field="srcip" lookup="address_match_key">etc/lists/example-ip-two</list>
  <description>IP matches example list two</description>
  <group>example-list-two,</group>
</rule>

<rule id="110710" level="10">
  <if_sid>110700</if_sid>
  <list field="srcip" lookup="address_match_key">etc/lists/example-ip-two</list>
  <description>IP matches both example lists</description>
  <group>example-list-one,example-list-two,</group>
</rule>
```

Rule 110710 depends on the match of 110700 and checks the second list, so it represents the presence of the address in both lists.

## What the documentation does not specify

The documentation does not specify a file size limit, memory use during building or the format of the compiled file. It does not describe reloading lists without a manager restart, including whether a list uploaded through `PUT /lists/files/{filename}` is compiled without a restart. It does not describe the behavior with duplicate keys, keys in CIDR notation, or the rule result when the key exists but the value does not match `check_value`. The documentation does not describe a list editor in the Wazuh dashboard. The logtest result in the example is an expectation consistent with the format from the documentation, not a capture from a running manager.

## Sources

- https://documentation.wazuh.com/current/user-manual/ruleset/cdb-list.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/ruleset.html
- https://documentation.wazuh.com/current/user-manual/ruleset/ruleset-xml-syntax/rules.html
- https://documentation.wazuh.com/current/user-manual/capabilities/malware-detection/cdb-lists-threat-intelligence.html
- https://documentation.wazuh.com/current/user-manual/ruleset/testing.html
- https://documentation.wazuh.com/current/user-manual/api/getting-started.html
- https://raw.githubusercontent.com/wazuh/wazuh/v4.14.0/api/api/spec/spec.yaml
- https://github.com/wazuh/wazuh/tree/v4.14.0/ruleset/lists
- https://raw.githubusercontent.com/wazuh/wazuh/v4.14.0/ruleset/rules/0095-sshd_rules.xml
- https://raw.githubusercontent.com/wazuh/wazuh/v4.14.0/ruleset/rules/0999-malicious-ioc-rules.xml
- https://raw.githubusercontent.com/wazuh/wazuh/v4.14.0/etc/ossec-server.conf
