Learn › Part 4 ยท Forensics, attack graphs and blockchain security
Attack graphs, trust scores and Hyperledger Fabric
Formal attack graphs, network model inputs, minimum hitting sets, trust-score arithmetic, and the Fabric pharma chaincode lab.
Formal attack graphs
Scanners list bugs host by host; attack graphs show how an intruder chains them. The system is a finite-state model M = (S, τ, s0): S is the product of the states of the intruder (E), defender/IDS (D) and network (N); τ is the set of allowed transitions; s0 is the start. A security property P is a set of safe executions (for example, “the intruder never gets root on the database host”). The attack graph is L(M) \ P: every execution that violates P.
| Input | Meaning |
|---|---|
| H | Hosts: services, software, vulnerabilities |
| C | Connectivity C(h1, h2, port), reflecting links and firewall rules |
| T | Trust relations between hosts |
| I | Intruder knowledge and privilege plvl(h) ∈ {none, user, root} |
| A | Actions with intruder/network preconditions and effects |
| Ids | Whether an action between two hosts is detectable, stealthy or both |
The minimum hitting set (critical action set) is the smallest set of actions to remove, by patching or firewalling, so that no path reaches the goal.
Case study: DMZ to internal database
Shortest path: web-server buffer overflow (root on the DMZ host) → proxy misconfiguration used for a port scan (knowledge) → chat-client remote-to-user exploit (user on Linux) → local setuid buffer overflow (root on Linux). If an IDS watches the DMZ-to-Linux link, the attacker pivots through the internal Windows host. Both paths share the chat-client exploit, so fixing that one action cuts both.
Trust-score propagation
Series (hops in sequence): T = T1 × T2 × … × Tk
Parallel (alternative paths into one node): T = TA + TB − TATB
Worked example
Path A: 0.8 × 0.9 = 0.72; path B = 0.10. Parallel: 0.72 + 0.10 − 0.072 = 0.748. A final hop of 0.8 gives 0.748 × 0.8 = 0.598.
Hyperledger Fabric
Fabric is a permissioned blockchain: every organisation, peer and user has an X.509 identity from a Membership Service Provider. Components: peers (ledger and world state, endorse and validate), the ordering service (orders transactions into blocks; never runs chaincode), channels (private ledgers), chaincode (smart contracts) and MSPs.
Transaction flow is execute → order → validate: endorsing peers simulate the chaincode and sign read/write sets; the orderer builds blocks; every peer checks the endorsement policy and MVCC read versions before committing. A successful endorsement is not a commit, so always query afterwards. Evaluate (read-only) transactions create no block.
| Function | Caller | Precondition | Result |
|---|---|---|---|
| CreateBatch(id, product, qty) | Org1MSP | New id, product set, qty > 0 | owner Org1MSP, CREATED |
| ReleaseBatch(id) | Org2MSP (QA) | CREATED | QA_RELEASED |
| TransferBatch(id, newOwner) | Current owner | QA_RELEASED, new owner ≠ caller | owner Org2MSP, IN_TRANSIT |
| ReceiveBatch(id) | Current owner | IN_TRANSIT | RECEIVED |
Negative tests check that duplicates, zero quantity, unknown IDs, release by Org1, transfer before release, receive before transfer and transfer by a non-owner are all rejected.
./network.sh up createChannel -ca
./network.sh deployCC -ccn pharma -ccp ../pharma-chaincode-java -ccl java
peer chaincode query -C mychannel -n pharma -c '{"function":"ReadBatch","Args":["BATCH-1001"]}'
./network.sh down
Common pitfalls
- Parallel trust is not a plain sum.
- The orderer does not validate business logic.
- A port scan changes knowledge, not privilege.