Software Engineering with Language Models
Module 12 · Network protection
- Class time
- 60 minutes
- Slides
- 32, each with teacher’s notes
- Goes with
- Laboratory 7; Assignment 6 (Part IV)
Where this module sits
- In Module 11 you audited one device by capturing its traffic on a controlled network.
- Module 12 is about the whole network.
- The aim is to limit what a compromised device or account can reach.
- You verify the design by observation.
- Module 13 is about the application and the agent deployment.
Objectives
- Derive a threat model from three facts about devices, exposure and credentials.
- Segment a network and prove from inside the segment that the segmentation holds.
- Deploy a filtering resolver, close the bypass and read its log.
- Describe a server that accepts no inbound connections, and say what that design leaves undone.
- Authenticate every request and authorise each identity for what it needs.
- State which channels an isolation claim considered.
Agenda
- 4 min: where this sits, objectives
- 10 min: threat model and the economics (12.1)
- 11 min: segmentation (12.2)
- 14 min: name-resolution filtering and outbound monitoring (12.3, 12.4)
- 13 min: no open ports, identity, residual channels (12.5 to 12.7)
- 8 min: mistakes, hand-ins, recap
Three facts for the threat model
- Consumer devices are computers with sensors.
- Consumer devices are rarely patched, and they report to their makers.
- Scanners find anything that listens on a public address within minutes.
- Search engines index exposed cameras, storage boxes and printers, and many of these devices still have default passwords.
- A stolen or phished credential grants whatever that identity is allowed to do.
The economics behind the first fact
- Between 2000 and 2022 the price of a television fell by about 97 per cent.
- One maker reported a quarterly loss of $6.7 million on devices.
- In the same quarter, advertising and data earned it $115.8 million in profit.
- The device is the collection point.
- A device can use the sensors of whatever is attached to it.
Worked example: reading the maker's accounts
- A set priced at 1,000 units in 2000 would cost about 30 units in 2022.
- The maker lost $6.7 million on devices in one quarter.
- It made a profit of $115.8 million on advertising and data in that quarter.
- The profit is about 17 times the loss.
- The net of the two lines is $109.1 million.
- The module's reading is that the device is the collection point.
Four boundaries that limit reach
| Boundary | What it limits | Section |
|---|---|---|
| Network segment | Which machines a device can contact | 12.2 |
| Name resolution | Which names a device can look up | 12.3 |
| Exposed ports | What answers on a public address | 12.5 |
| Identity | What one account can see and do | 12.6 |
The segmentation design
- Televisions, cameras, speakers and appliances go on a separate network.
- The separate network can be the guest or IoT network of a router, or a VLAN.
- The separate network cannot initiate connections to laptops, phones and storage.
- The reasoning is containment.
- A compromised device sees only its neighbours.
Two segments and the rule between them
router
/ \
trusted untrusted
laptop television
phone camera
storage speaker
untrusted --X--> trusted
(may not initiate)
Worked example: proving the segment holds
- Before any change, scan the trusted devices from the television's position. Save the output.
- Move the untrusted devices to their own segment.
- Add the rule that the untrusted segment may not initiate connections to the trusted segment.
- Repeat the same scan from inside the untrusted segment.
- The expected result is that no trusted host answers.
- Hand in both outputs.
In-class exercise: a segment for each device
- The devices are a laptop, a phone, a storage box, a television, a camera, a speaker and a printer.
- Assign each device to the trusted or the untrusted segment.
- State which segment may initiate connections to the other.
- Write the test that proves the design.
- Name the device that is hardest to place, and say why.
The reason to filter at name resolution
- Most device telemetry begins with a DNS lookup.
- One filtering resolver that serves the whole network blocks the telemetry at the lookup.
- The resolver covers devices on which nothing can be installed.
- The resolver can be hosted or self-hosted.
Five steps for filtering at name resolution
- Choose a filtering resolver, hosted or self-hosted.
- Enable a maintained blocklist, plus vendor tracking lists for the makers you own.
- Point the router at it over an encrypted transport where supported.
- Block outbound port 53 to everything except the router.
- Read the query log.
The bypass and the rule that closes it
normal path
device -> router -> filtering
resolver
bypass
device --port 53--> own resolver
X
blocked: outbound 53 is allowed
only to the router
Worked example: reading the query log
blocked name device count
ads-name-1 television 4,120
stats-name-2 television 1,870
track-name-3 speaker 310
update-name-4 camera 12
48 hours of log, toy figures
Ask the room: lookups missing from the query log
- A filtering resolver has run for a week.
- One television's lookups never appear in the resolver's query log.
- The television still plays streamed programmes.
- Give the likeliest explanation.
- Name the rule that closes the gap, and say how to confirm it.
Turning collection off at the source
- The setting has a different name on each brand of television.
- The names in use are viewing information services, live plus, viewing data and use info from TV inputs.
- The published audit confirms that opting out stops the traffic.
- Opt out of interest-based advertising and reset the advertising identifier.
- Disable voice recognition.
- Remove unused applications.
Traffic monitoring
- On a workstation, a per-application outbound monitor shows which programs connect out.
- The monitor also shows how often each program connects and how much it sends.
- Unexpected chatter is a reason to uninstall.
- On a server, every inbound connection attempt is logged.
- An attempt from outside the expected set raises an alert.
- You can audit any device behind a network you control, as in Module 11.
A server with no open ports
- Administrative access runs only over a private mesh network.
- SSH listens on the mesh address and nowhere else.
- Public traffic enters through an outbound tunnel that ends at a content network's reverse proxy.
- The server accepts no inbound connections.
- The firewall closes every inbound port on the public address.
Diagram of a server with no open ports
scanner --X--> public address
(all ports closed)
server == outbound tunnel ==> proxy
visitor ------------------> proxy
admin -- mesh --> SSH on the
mesh address
Worked example: closing the ports in order
- At the start, SSH and a web port answer on the public address.
- Join the server to the mesh and confirm that SSH works over the mesh address.
- Set the SSH daemon to listen on the mesh address alone.
- Route public traffic through the outbound tunnel and confirm that the site loads.
- Close every inbound port on the public address at the firewall.
- Scan the public address from outside and confirm that nothing answers.
The remaining needs of a closed server
- Closing the ports removes scanning exposure.
- Closing the ports also removes brute-force exposure.
- The server still needs patching.
- The application still needs securing.
- The server still needs backups that have been restored at least once.
Segmentation by identity
- Network location is a weak basis for trust.
- Every request is authenticated.
- Each identity is authorised only for the pages, functions and endpoints it needs.
- An intruder with a valid account sees only that one account's slice.
- When abuse is detected, that account is suspended automatically.
- The damage is limited to one identity.
Address allowlists and their replacement
- Functions are usually exposed to another organisation through an IP allowlist.
- The module calls the method brittle.
- An allowlist breaks with remote work.
- An allowlist breaks with shared egress addresses.
- The durable alternative is identity-based access.
- Identity-based access uses credentials that are short-lived and bound to a device or key.
Ask the room: one phished account
- An attacker holds one phished account for an internal service.
- Design A trusts any request from inside the network in full.
- Design B authenticates every request and authorises it per identity.
- State what the attacker can reach under each design.
- State what ends the intrusion under design B.
Residual channels
- Removing shared files and network links leaves other paths between isolated processes.
- A timing side channel carries a signal in how long a shared resource takes to respond.
- A cache is one such shared resource.
- One second-hand, unverified report describes agents exchanging information this way.
- The mechanism is well established.
- An isolation claim for a multi-agent system names the channels it considered.
Common mistakes
- Writing a rule and not testing it. Fix: scan from inside the untrusted segment.
- Filtering DNS and leaving outbound port 53 open. Fix: allow that port only to the router.
- Never reading the query log. Fix: review the log, and allow the names that break updates.
- Treating no open ports as secure. Fix: patch the server, secure the application and restore a backup.
- Trusting by network location or address allowlist. Fix: authenticate and authorise each identity.
- Repeating unverified reports as fact. Fix: label them, and test them where possible.
Laboratory 7: what is due
- (a) An inventory of every device, with its maker and its purpose.
- (b) Untrusted devices moved to a separate segment, with proof that the trusted segment is unreachable.
- (c) A filtering resolver deployed, and outbound port 53 blocked.
- After 48 hours, report the ten most frequent blocked names and the device that asked for each.
- (d) A scan of your public address from outside, accounting for every open port.
- Hand in the before and the after for a network you administer.
Assignment 6 · A search engine served securely: what is due
- A search engine for a few hundred text files that are yours to use.
- Step 3 belongs to this module and puts the engine behind a small web server.
- The server is bound to the local machine only.
- From outside, the server is reached by tunnel or private network, and no inbound port is opened.
- Query length and request rate are limited.
- A query is data and never enters a shell command, file path or prompt.
Recap
- The threat model is unpatched devices that report home, constant scanning and stolen credentials.
- Protection means limiting reach by segment, name resolution, exposed ports and identity.
- A rule counts once it has been tested from the side it is meant to stop.
- Filter DNS for the whole network, block outbound port 53 and read the log.
- Closing every port removes scanning and brute-force exposure and nothing else.
- An isolation claim names the channels it considered.
Before next class
- Start Laboratory 7 part (c) at once, because the report needs 48 hours of log.
- Take the "before" scans from inside the device network and from outside.
- Do step 3 of Assignment 6.
- Read Module 13 on cyber security for builders and their agents.
- For Laboratory 8, choose an application you built and create a second account on it.