Build an exposure inventory of your own AI lab and plant a honeytoken
Task
The lesson's central point is that "technically public, but nobody will find it" stops being a risk position once correlation is cheap. Test that against the one system you are entitled to examine, your own lab. Inventory its listening sockets, what its gateway gives away in headers and errors, and what its documents disclose when joined together. Then place a honeytoken where automated collection would find it, and prove that an alert fires when it is used.
Steps
- In the VM, list listening TCP sockets with
sudo ss -tlnp. Record each one inlab/exposure-inventory.csvwith headerid,asset,port,bound_to,where_found,what_it_reveals,correlates_with,action,owner. The model runner and the gateway (port 8088) should both be bound to 127.0.0.1 only. Anything bound to 0.0.0.0 or to the host-only address is a finding, even when you meant it. From the host, over the host-only adapter, confirm that port 8088 on the VM's host-only address does not answer, and record that as a row too. - Inside the VM, send your gateway at
$GW(127.0.0.1:8088) one request to an unknown path, onePOST /askwith a malformed body and one with nouser. Record everything the responses reveal, such as a server header, the framework, the model name, file paths, a stack trace or the wording of ablock:refusal, as one row each withportleft blank. - Read your own
docs/the way an automated collector would: the owners and departments in each document's metadata, the names and numbers in the on-call rota, and the product FAQ. Add a row for every fact that becomes more useful when joined to another, and name the other incorrelates_with. The rota's names combined with the email format in the HR policy is the classic pair. - Place a honeytoken. Add
docs/ops-credentials.md, assecai-docs(lesson 17 gave that account the documents), with front matterclassification: internal,owner: it-opsanddepartment: it, holding an invented key,HONEY-3F9K-SECAI-NOT-A-KEY, and record inlab/honeytoken.mdwhere it is, why that is where collection would look, and what an alert on it means. Re-index the documents so retrieval can find it, and addhoney-testtoapp/users.jsonwithpublicandinternal, so the test user can retrieve an internal document. - Add a check to
gateway/gateway.py, incheck_response(), lesson 2's post-model hook, where bothrec["prompt"]andrec["response"]are filled in: append a line tologs/honeytoken-alerts.logwhenever either contains the honeytoken, and return None, so the alert observes without refusing. Then ask the app about operations credentials, through the gateway as userhoney-test, and confirm the alert fires. - For every row, set
actionto close, reduce, accept or monitor, and name anowner. Close what you can, such as a verbose error or a socket bound wider than needed, and rerun step 1. Shrinking the footprint is the defence the lesson names, and this is that work done on a system you are entitled to change.
Verify
cd ~/secai-lab
python - <<'EOF'
import csv, subprocess
out = subprocess.run(['ss', '-tln'], capture_output=True, text=True).stdout.splitlines()[1:]
socks = [l.split()[3] for l in out if l.strip()]
ports = {s.rsplit(':', 1)[1] for s in socks}
inv = list(csv.DictReader(open('lab/exposure-inventory.csv')))
listed = {r['port'] for r in inv if r['port']}
print('listening ports:', sorted(ports))
print('listening but not in the inventory:', sorted(ports - listed) or 'none')
print('bound beyond loopback:', [s for s in socks if not s.startswith(('127.', '[::1]'))] or 'none')
print('rows with no action or owner:', sum(1 for r in inv if not r['action'] or not r['owner']))
EOF
grep -c HONEY-3F9K-SECAI-NOT-A-KEY logs/honeytoken-alerts.log
No listening port is missing from the inventory, and no row lacks an action or an owner. Every socket bound beyond loopback is one you chose deliberately, typically none, or only SSH if you use it, and it appears in the inventory with an action. The gateway's 8088 must not be in that list. The honeytoken alert count is at least 1. If it is 0, either the re-index did not pick up the new document or the check looks only at the user's prompt, not at the response.
Notes
Look at the correlates_with column when you finish. In a lab with six documents you will still find a handful of pairs that together say more than either one alone, and an organisation's public footprint has thousands. That is the lesson's argument for treating your own exposure as something to measure continuously rather than something to assume.
This is an independent study companion for CompTIA SecAI+ CY0-001 and is not produced by or endorsed by CompTIA.