nel-chain threat model and audit checklist
Generated from src/features/threats/threats.ts by npm run threats; do not edit by hand. Version 0.1, a draft for a future external audit. No external audit has been done.
44 threats: 16 mitigated, 27 partial, 1 open. Each entry names the attacker, the defense in the code, what remains, and the files and tests to check. Categories follow STRIDE.
Not yet mitigated
| ID | Area | Threat | Status | Residual risk |
|---|---|---|---|---|
| T01 | Identity | Fake person through two colluding attesters | Partial | Fakes up to the daily cap still get in until someone notices; detection depends on audits and courts outside the chain. |
| T02 | Identity | Stolen attester key | Partial | There is no on-chain rotation of an attester key: a jailed attester needs a new genesis or a future governance transaction to return. |
| T03 | Identity | One person, two Soul IDs | Partial | Uniqueness is only as good as PhilSys deduplication; people without PhilSys must register first. |
| T05 | Identity | False death report | Partial | Someone who cannot reach a device during the whole grace period (30 days in the mainnet draft) loses the money to their beneficiary; the chain cannot undo it, so it must be recovered between people or through a court. |
| T06 | Identity | Guessing ID numbers from the person hash | Partial | Any attester holding the salt can still test guesses. Masked names and barangays leak a little. |
| T34 | Identity | Leak of biometric data | Partial | PhilSys and each attester still hold biometrics off-chain, under the Data Privacy Act; a breach there is outside the chain's control and permanent. |
| T35 | Identity | Fooling the face or fingerprint check | Partial | The chain cannot verify that liveness really happened; it records the attester's or voucher's word, and strikes are the consequence if they lied. A skilled deepfake on a screen held to the camera may still pass the on-device check. |
| T40 | Identity | Vouching rings | Partial | Without an ID registry there is no deduplication: a patient ring can still grow slowly, and nothing stops one real person from being vouched twice on two addresses by complicit friends. |
| T09 | Consensus | Capturing the committee | Partial | Rests entirely on identity: an attacker who fakes or recruits a large share of staking people (T01) breaks it. |
| T11 | Consensus | Long-range attack with retired keys | Partial | Blocks after the newest checkpoint are still unprotected for a node syncing only from attacker peers, so checkpoints must be refreshed in every release; the lists are empty until a public testnet runs. |
| T43 | Consensus | Stolen validator node key | Partial | Until the owner rotates, the thief can double-vote and get the stake slashed. Phase 59 nodes that still run with the wallet key itself remain exposed until they switch (npm run validator -- --new-key). |
| T13 | Consensus | Bootstrap validators stalling or forking the young chain | Partial | Until then they can stall the chain; operators should be independent people. |
| T14 | Consensus | Censoring transactions | Partial | A large colluding group can delay transactions for many blocks; there is no forced-inclusion rule. |
| T15 | Consensus | Quantum computer forging consensus signatures | Open | Votes and the VRF still use Ed25519; there is no standard post-quantum VRF yet. |
| T37 | Wallet and users | Payer walking away from channel payments | Partial | The store must claim before expiry and must not lose its latest voucher; a lost phone means lost payments since the last claim. |
| T21 | Network | Eclipse attack | Partial | An attacker with addresses in many networks can still try; there is no ASN map yet. |
| T23 | Network | Plain WebSocket for browsers | Partial | Without the proxy, balances and lookups are readable on the path, and a fake node can lie about them. |
| T38 | Network | Attacking the operator's home computer through the tunnel | Partial | A bug in the node or the web app would be reachable from the internet on the operator's own computer; while the operator is the only validator host, the testnet stops when that computer is off. |
| T25 | Wallet and users | Paying a scammer | Partial | Warnings do not block payments, and a final payment cannot be reversed. |
| T27 | Wallet and users | Guessing the PIN of a copied wallet | Partial | One million PINs is still a small space for a determined attacker; passkeys (secure hardware) are the real fix. Backup codes, which leave the device, require a password of 10 or more characters instead of the PIN; a weak password chosen anyway can still be guessed offline. |
| T28 | Wallet and users | Script injection in the web app | Partial | Inline scripts are still allowed ('unsafe-inline'), because partial prerendering cannot use nonces; and WebSocket connections may go to any host, because users choose their own node. |
| T29 | Institutions | Unbacked digital pesos | Partial | Issuer and auditor together can hide a shortfall. NEL is unaffected. |
| T30 | Institutions | Abuse of lawful disclosure | Partial | Court plus one other trustee can de-anonymize anyone; the protection is visibility, not prevention. |
| T31 | Institutions | Leaked institution key file | Partial | No on-chain key rotation for institutions; no hardware security module support. |
| T32 | Economics | Inflating the supply with fake people | Partial | Grants already spent before a revocation stay in circulation. |
| T44 | Wallet and users | Guardians colluding to take an account | Partial | An owner who does not open the wallet during the delay loses the account; a thief holding the owner's key can cancel a majority recovery, so recovering from theft then needs every guardian. The Soul ID check on guardians is done by the wallet, not by the chain. |
| T42 | Economics | Quietly changing the money rules | Partial | The fingerprint covers the declared numbers and the name of the burn-cap formula, not the code of every formula; reviewers and the economics tests guard the formulas themselves. |
| T33 | Economics | Front-running swaps | Partial | Within its own block a proposer can still order transactions as it likes. |
Identity
T01. Fake person through two colluding attesters
Partial · Spoofing
- Attack: Two attesters of different kinds (for example a government office and a bank) agree to vouch for people who do not exist, to collect welcome grants and lottery tickets.
- Defense: Two kinds of attester are required; census check per barangay; welcome grant locked for 30 days; court can revoke (soul-fake) and burn what is left; strikes suspend an attester after 3 fakes; at most 20,000 attestations per attester per day.
- Residual risk: Fakes up to the daily cap still get in until someone notices; detection depends on audits and courts outside the chain.
- Code:
src/features/attesters/rules.ts,src/features/soul-id/rules.ts - Tests:
src/features/attesters/attesters.test.ts,src/features/attesters/fake-soul.test.ts
T02. Stolen attester key
Partial · Elevation of privilege
- Attack: An attacker steals an attester's signing key and attests identities at machine speed.
- Defense: A second attester of another kind is still needed; the daily cap limits volume; per-attester counters are public; strikes and jailing stop the key.
- Residual risk: There is no on-chain rotation of an attester key: a jailed attester needs a new genesis or a future governance transaction to return.
- Code:
src/features/attesters/registry.ts,src/features/attesters/rules.ts - Tests:
src/features/attesters/fake-soul.test.ts
T03. One person, two Soul IDs
Partial · Spoofing
- Attack: A real person enrolls twice, at two attesters or with a second address.
- Defense: Any valid ID is accepted for the second attestation, but the first must come from PhilSys, whose biometric deduplication (1:N) already ensures one number per person; the person hash is always the PhilSys number and must be unique, including pending applications.
- Residual risk: Uniqueness is only as good as PhilSys deduplication; people without PhilSys must register first.
- Code:
src/features/soul-id/identity.ts,src/features/attesters/rules.ts,src/features/soul-id/id-types.ts - Tests:
src/features/soul-id/soul-id.test.ts,src/features/soul-id/any-id.test.ts
T04. Linking someone else's address as a signing key
Mitigated · Spoofing
- Attack: An identity key links a victim's address to its Soul ID to borrow its history or block it.
- Defense: Every link carries the signing key's own consent signature over (identity, key).
- Residual risk: none known.
- Code:
src/features/soul-id/rules.ts - Tests:
src/features/soul-id/soul-id.test.ts
T05. False death report
Partial · Denial of service
- Attack: A registrar, or two colluding people with Soul IDs, report a living person as dead (or lost in danger) to freeze or redirect their money.
- Defense: A grace period freezes the keys but moves nothing; the owner cancels with 'I am alive'. A community report needs two different Soul IDs held long enough to vouch; each cancelled 'dead' report gives every reporter a strike, and two strikes end their right to report. A 'lost in danger' report moves nothing until the person has shown no activity for years (4 in the mainnet draft), and any activity voids it.
- Residual risk: Someone who cannot reach a device during the whole grace period (30 days in the mainnet draft) loses the money to their beneficiary; the chain cannot undo it, so it must be recovered between people or through a court.
- Code:
src/features/inheritance/rules.ts,src/features/life/rules.ts - Tests:
src/features/inheritance/inheritance.test.ts,src/features/life/life.test.ts
T06. Guessing ID numbers from the person hash
Partial · Information disclosure
- Attack: Anyone reading the chain tries every possible ID number to find who owns a Soul ID.
- Defense: The hash is an HMAC keyed with a secret salt held only by attesters; the full record is encrypted 2-of-3.
- Residual risk: Any attester holding the salt can still test guesses. Masked names and barangays leak a little.
- Code:
src/features/soul-id/identity.ts,src/features/chain/key-file.ts - Tests:
src/features/soul-id/soul-id.test.ts
T34. Leak of biometric data
Partial · Information disclosure
- Attack: Someone obtains fingerprints or face templates collected during verification; unlike a password, a fingerprint cannot be changed.
- Defense: Biometrics never reach the chain: an attestation with any field beyond the allowed ones is rejected, and it records only which kind of check was done (ID type, face or fingerprint, liveness). Deduplication reuses PhilSys, which already holds the data, instead of a new database.
- Residual risk: PhilSys and each attester still hold biometrics off-chain, under the Data Privacy Act; a breach there is outside the chain's control and permanent.
- Code:
src/features/attesters/rules.ts,src/features/soul-id/id-types.ts - Tests:
src/features/soul-id/any-id.test.ts
T35. Fooling the face or fingerprint check
Partial · Spoofing
- Attack: A photo, video, deepfake or fake fingerprint passes the biometric check at an attester.
- Defense: Every attestation must state that a liveness check was done; two attesters of different kinds check independently. Vouchers can run an on-device liveness check (random blink and head-turn challenges) on their own camera, so a photo or replayed video does not pass.
- Residual risk: The chain cannot verify that liveness really happened; it records the attester's or voucher's word, and strikes are the consequence if they lied. A skilled deepfake on a screen held to the camera may still pass the on-device check.
- Code:
src/features/attesters/rules.ts,src/features/liveness/liveness.ts - Tests:
src/features/soul-id/any-id.test.ts,src/features/liveness/liveness.test.ts
T40. Vouching rings
Partial · Spoofing
- Attack: A group of people with Soul IDs vouch for fake or duplicate people, and the new fakes vouch for more.
- Defense: Two different vouchers are required, optionally after an in-person AI liveness check on the voucher's own camera (recorded as passed or not, never an image); a voucher must have held a Soul ID for a while and may vouch for at most 3 people per period; a court-declared fake gives every voucher a strike, and two strikes end vouching; new Soul IDs still wait out the welcome lock before earning or joining the lottery.
- Residual risk: Without an ID registry there is no deduplication: a patient ring can still grow slowly, and nothing stops one real person from being vouched twice on two addresses by complicit friends.
- Code:
src/features/vouch/rules.ts,src/features/attesters/rules.ts - Tests:
src/features/vouch/vouch.test.ts
Consensus
T07. Double voting (equivocation)
Mitigated · Tampering
- Attack: A committee member signs two different blocks at the same height and round to split the network.
- Defense: Anyone can submit both signatures as evidence; the voter loses 50% of its stake, which is burned.
- Residual risk: none known.
- Code:
src/features/consensus/slashing.ts,src/features/consensus/votes.ts - Tests:
src/features/consensus/consensus.test.ts
T08. Knocking the next proposer offline
Mitigated · Denial of service
- Attack: An attacker learns who proposes next and floods that node during its few seconds.
- Defense: Proposers are drawn secretly by VRF; the proof is revealed only with the block, about five per round.
- Residual risk: none known.
- Code:
src/features/consensus/committee.ts,src/features/network/node.ts - Tests:
src/features/network/network.test.ts
T09. Capturing the committee
Partial · Elevation of privilege
- Attack: An attacker controls enough candidates to reach two-thirds of a drawn committee.
- Defense: One ticket per person, not per coin; secret sortition; with E = 1,000 the odds for a 20% attacker are negligible (see the whitepaper's captureOdds table).
- Residual risk: Rests entirely on identity: an attacker who fakes or recruits a large share of staking people (T01) breaks it.
- Code:
src/features/consensus/committee.ts - Tests:
src/features/consensus/staking.test.ts,src/features/consensus/consensus.test.ts
T10. Fresh fake identities joining the lottery at once
Mitigated · Elevation of privilege
- Attack: A batch of newly created fake Soul IDs stakes immediately to win committee seats before anyone checks them.
- Defense: A Soul ID becomes a candidate only after its welcome lock ends (30 days in the mainnet draft).
- Residual risk: none known.
- Code:
src/features/consensus/committee.ts,src/features/soul-id/rules.ts - Tests:
src/features/consensus/staking.test.ts
T11. Long-range attack with retired keys
Partial · Tampering
- Attack: Validators who have unstaked (and can no longer be slashed) sign an alternative history from an old height and feed it to a new node.
- Defense: Finality means honest nodes never switch; unbonding delays exit; a new node checks every vote against the sortition of its own history; known block hashes (checkpoints) ship with the software and any other block at those heights is refused.
- Residual risk: Blocks after the newest checkpoint are still unprotected for a node syncing only from attacker peers, so checkpoints must be refreshed in every release; the lists are empty until a public testnet runs.
- Code:
src/features/chain/chain.ts,src/features/chain/params.ts,scripts/checkpoint.ts - Tests:
src/features/chain/time-checkpoint.test.ts,src/features/chain/verify.test.ts
T43. Stolen validator node key
Partial · Elevation of privilege
- Attack: Someone copies the key file from the always-on computer that runs a validator node.
- Defense: The node can run with its own consensus key, registered on chain by the wallet (validator-key). That key only votes: it cannot move NEL, pesos or the stake, and the wallet stays in NelPay. The owner registers a new key and the stolen one stops counting from the next block. A retired key still proves double votes it signed while active, so rotating does not escape slashing, but it cannot be used to frame the owner for later blocks, and evidence older than the unbonding period is refused.
- Residual risk: Until the owner rotates, the thief can double-vote and get the stake slashed. Phase 59 nodes that still run with the wallet key itself remain exposed until they switch (npm run validator -- --new-key).
- Code:
src/features/consensus/staking.ts,src/features/consensus/slashing.ts,src/features/chain/key-file.ts,scripts/validator.ts - Tests:
src/features/consensus/validator-key.test.ts
T12. Block time set by the proposer
Mitigated · Tampering
- Attack: A proposer writes any timestamp in its block.
- Defense: Every deadline is counted in blocks, not time, so the timestamp moves no money. Each block's time must be later than the previous block's, and honest nodes do not store or vote for a proposal more than 15 seconds ahead of their own clock. A proposer whose clock runs behind still stamps its block one millisecond after the previous one, so clock skew does not waste rounds.
- Residual risk: none known.
- Code:
src/features/chain/chain.ts,src/features/network/node.ts - Tests:
src/features/chain/time-checkpoint.test.ts
T13. Bootstrap validators stalling or forking the young chain
Partial · Denial of service
- Attack: The four genesis validators refuse to sign, or collude, before real people stake.
- Defense: They earn nothing and leave the candidate pool once four people with Soul IDs stake.
- Residual risk: Until then they can stall the chain; operators should be independent people.
- Code:
src/features/consensus/stakes.ts,src/features/consensus/committee.ts - Tests:
src/features/consensus/fair-launch.test.ts
T14. Censoring transactions
Partial · Denial of service
- Attack: A winning proposer leaves out a victim's transactions.
- Defense: The proposer changes every block by secret draw, so a censored transaction waits only until an honest proposer wins.
- Residual risk: A large colluding group can delay transactions for many blocks; there is no forced-inclusion rule.
- Code:
src/features/network/node.ts,src/features/consensus/consensus.ts - Tests:
src/features/network/network.test.ts
T15. Quantum computer forging consensus signatures
Open · Spoofing
- Attack: A future quantum computer derives Ed25519 secret keys from public keys and forges votes or VRF proofs.
- Defense: Account keys can move to ML-DSA (FIPS 204) today.
- Residual risk: Votes and the VRF still use Ed25519; there is no standard post-quantum VRF yet.
- Code:
src/features/wallet/keys.ts,src/features/consensus/vrf.ts - Tests:
src/features/wallet/keys.test.ts,src/features/consensus/vrf.test.ts
Ledger
T16. Replaying a transaction
Mitigated · Tampering
- Attack: An old signed transaction is sent again, or a testnet transaction is sent to mainnet.
- Defense: Every signature covers the chain ID; every account has a nonce.
- Residual risk: none known.
- Code:
src/features/chain/transaction.ts,src/features/chain/state.ts - Tests:
src/features/chain/chain.test.ts,src/features/chain/params.test.ts
T17. Editing a past block
Mitigated · Tampering
- Attack: Someone changes an amount in an old block on disk or in transit.
- Defense: Hash chain, Merkle root and a full replay of every block from genesis when a node loads or syncs.
- Residual risk: none known.
- Code:
src/features/chain/verify.ts,src/features/chain/block.ts,src/features/chain/merkle.ts - Tests:
src/features/chain/verify.test.ts,src/features/chain/chain.test.ts
T18. Filling blocks with junk
Mitigated · Denial of service
- Attack: A spammer sends huge or numerous transactions.
- Defense: 16 KB per transaction; at most 4,000 transactions and 4 MB per block; an EIP-1559 base fee that rises while blocks are full.
- Residual risk: none known.
- Code:
src/features/chain/transaction.ts,src/features/chain/fees.ts,src/features/chain/chain.ts - Tests:
src/features/chain/fees.test.ts,src/features/network/hardening.test.ts
T36. Slowing every node with a large ledger
Mitigated · Denial of service
- Attack: With millions of accounts, a design that copies the whole ledger on every transaction makes each block take minutes to check.
- Defense: Accounts live in a persistent map: an update copies a few small nodes, and the KYC cap check looks only at accounts that changed. Measured at about 3,900 transfers per second per core with a million accounts.
- Residual risk: none known.
- Code:
src/features/chain/pmap.ts,src/features/kyc/rules.ts,scripts/capacity.ts - Tests:
src/features/chain/pmap.test.ts
T19. Moving a locked welcome grant
Mitigated · Elevation of privilege
- Attack: A fake identity tries to move its locked 10 NEL, directly or through its own signing key.
- Defense: While locked, the identity key may pay fees and stake but cannot send; revocation also burns staked welcome.
- Residual risk: none known.
- Code:
src/features/chain/state.ts,src/features/soul-id/rules.ts - Tests:
src/features/attesters/fake-soul.test.ts
Network
T20. Flooding a node with messages
Mitigated · Denial of service
- Attack: A peer sends many, malformed or oversized messages.
- Defense: Shape check on every message, size cap, token bucket per connection, misbehavior score and 24-hour bans.
- Residual risk: none known.
- Code:
src/features/network/validate-message.ts,src/features/network/peer-guard.ts,src/features/network/limits.ts - Tests:
src/features/network/hardening.test.ts
T21. Eclipse attack
Partial · Spoofing
- Attack: An attacker fills all of a node's connections so it sees only the attacker's view.
- Defense: Limits per IP and per /16 group, one outbound per group, eviction that protects old and useful peers, anchor connections, address book caps per group and per source.
- Residual risk: An attacker with addresses in many networks can still try; there is no ASN map yet.
- Code:
src/features/network/netgroup.ts,src/features/network/eviction.ts,src/features/network/address-book.ts - Tests:
src/features/network/netgroup.test.ts,src/features/network/address-book.test.ts
T22. Eavesdropping or tampering between nodes
Mitigated · Information disclosure
- Attack: Someone on the path reads or changes node-to-node traffic.
- Defense: X25519 key exchange, HKDF, ChaCha20-Poly1305 and an Ed25519-signed handshake on every peer link.
- Residual risk: none known.
- Code:
src/features/network/secret-connection.ts - Tests:
src/features/network/secret-connection.test.ts
T23. Plain WebSocket for browsers
Partial · Information disclosure
- Attack: Someone on the path reads or changes what a wallet in the browser sends to a node.
- Defense: Transactions are signed in the browser, so they cannot be changed; the deployment kit puts a TLS proxy in front of public nodes.
- Residual risk: Without the proxy, balances and lookups are readable on the path, and a fake node can lie about them.
- Code:
deploy/Caddyfile,src/features/node-client/node-client.ts - Tests: none yet
T24. Running a node out of memory
Mitigated · Denial of service
- Attack: A peer sends endless transactions, votes for many different blocks, or asks for the whole chain at once.
- Defense: Bounded mempool, at most 16 block hashes counted per height, sync in batches; wallet history comes from an address index built once per block instead of scanning the whole chain on every request.
- Residual risk: none known.
- Code:
src/features/network/node.ts,src/features/network/limits.ts,src/features/network/history-index.ts - Tests:
src/features/network/hardening.test.ts,src/features/network/history.test.ts
T38. Attacking the operator's home computer through the tunnel
Partial · Elevation of privilege
- Attack: Someone uses the public tunnel link to reach the operator's own computer, or floods it to stop the young testnet.
- Defense: The tunnel forwards only the seed node and the web app, never the key files; the node sees each peer's real address (CF-Connecting-IP) and applies the usual limits and bans; friends' nodes connect out, so the chain survives if they keep running.
- Residual risk: A bug in the node or the web app would be reachable from the internet on the operator's own computer; while the operator is the only validator host, the testnet stops when that computer is off.
- Code:
scripts/home-testnet.ts,scripts/testnet-join.ts,src/features/network/server.ts - Tests:
src/features/network/hardening.test.ts
T41. Reading or flooding the operator inbox
Mitigated · Information disclosure
- Attack: Someone reads the testnet operator's inbox of verify requests (names and ID numbers) or fills it with junk so real requests are dropped.
- Defense: The inbox lives only in the node's memory, never on chain. Reading or resolving it needs both a local connection and a random operator token written with mode 0600 next to the node's data, compared in constant time; so a proxy that makes every visitor look local is not enough. Each sender may have at most 5 waiting requests, and the inbox holds at most 100.
- Residual risk: none known.
- Code:
src/features/inbox/types.ts,src/features/network/server.ts,scripts/approve.ts - Tests:
src/features/inbox/inbox.test.ts
Wallet and users
T37. Payer walking away from channel payments
Partial · Repudiation
- Attack: A payer pays a store with channel vouchers, then tries to keep the money.
- Defense: The deposit is locked on-chain at opening; every voucher is signed by the payer and checked by the store at once; the payer can only take the deposit back after the channel expires.
- Residual risk: The store must claim before expiry and must not lose its latest voucher; a lost phone means lost payments since the last claim.
- Code:
src/features/channels/rules.ts,src/features/channels/voucher.ts,src/features/channels/voucher-store.ts,src/features/channels/suki-card.tsx - Tests:
src/features/channels/channels.test.ts,src/features/channels/voucher-link.test.ts
T25. Paying a scammer
Partial · Spoofing
- Attack: A scammer persuades a user to send money.
- Defense: Before paying, the wallet shows the Soul ID and masked name, first-time payments, reports from distinct people, a brand-new-account warning and court freezes.
- Residual risk: Warnings do not block payments, and a final payment cannot be reversed.
- Code:
src/features/scam-shield/check.ts,src/features/scam-shield/rules.ts - Tests:
src/features/scam-shield/scam.test.ts,src/features/attesters/fake-soul.test.ts
T26. Stolen phone
Mitigated · Elevation of privilege
- Attack: A thief with the unlocked phone tries to drain the account or remove its limits.
- Defense: Daily limit (covering transfers, escrow, paluwagan and payment channels alike), undo window for large payments, delay on new settings, guardians to move to a new key, passkeys that need fingerprint or face.
- Residual risk: none known.
- Code:
src/features/safety/rules.ts,src/features/passkey/webauthn-signature.ts - Tests:
src/features/safety/safety.test.ts,src/features/passkey/webauthn-signature.test.ts,src/features/channels/channels.test.ts
T27. Guessing the PIN of a copied wallet
Partial · Information disclosure
- Attack: Someone copies the encrypted wallet from a device and tries every 6-digit PIN offline.
- Defense: PBKDF2 with 600,000 iterations and a random salt slows every guess.
- Residual risk: One million PINs is still a small space for a determined attacker; passkeys (secure hardware) are the real fix. Backup codes, which leave the device, require a password of 10 or more characters instead of the PIN; a weak password chosen anyway can still be guessed offline.
- Code:
src/features/wallet-app/secure-storage.ts,src/features/wallet-backup/backup.ts - Tests:
src/features/wallet-app/wallet-app.test.ts,src/features/wallet-backup/backup.test.ts
T28. Script injection in the web app
Partial · Elevation of privilege
- Attack: Injected script in the web app reads unlocked keys or signs payments.
- Defense: React escapes all text; no raw HTML is rendered. A Content-Security-Policy blocks scripts from other sites, plugins and framing, and limits where data can be sent; other headers stop MIME sniffing, referrer leaks, and access to location and microphone.
- Residual risk: Inline scripts are still allowed ('unsafe-inline'), because partial prerendering cannot use nonces; and WebSocket connections may go to any host, because users choose their own node.
- Code:
next.config.ts,src/features/security/headers.ts - Tests:
src/features/security/headers.test.ts
T44. Guardians colluding to take an account
Partial · Elevation of privilege
- Attack: A majority of an account's guardians approve a new key that they control, taking the money, Soul ID and stake at the same address.
- Defense: Approval by a majority (not all) of the guardians only takes effect after a delay (1 day in the mainnet draft), during which the current owner sees a warning in the wallet and can cancel with recovery-cancel; a key change cannot be queued over a pending recovery. Only unanimous approval is immediate, for the case of a thief draining the account. The wallet accepts only guardians who hold Soul IDs, so one person cannot be several guardians.
- Residual risk: An owner who does not open the wallet during the delay loses the account; a thief holding the owner's key can cancel a majority recovery, so recovering from theft then needs every guardian. The Soul ID check on guardians is done by the wallet, not by the chain.
- Code:
src/features/safety/rules.ts,src/features/safety/guardians-card.tsx - Tests:
src/features/safety/safety.test.ts
Institutions
T29. Unbacked digital pesos
Partial · Tampering
- Attack: The issuer mints nPHP without real pesos in the bank.
- Defense: Minting cannot exceed the reserves last attested by the auditor; every mint and attestation is public.
- Residual risk: Issuer and auditor together can hide a shortfall. NEL is unaffected.
- Code:
src/features/stablecoin/rules.ts - Tests:
src/features/stablecoin/stablecoin.test.ts
T30. Abuse of lawful disclosure
Partial · Information disclosure
- Attack: A court reads identities or freezes accounts without a real case.
- Defense: The record is split 2-of-3 (court, issuer, auditor); every case, approval and freeze is a public transaction.
- Residual risk: Court plus one other trustee can de-anonymize anyone; the protection is visibility, not prevention.
- Code:
src/features/disclosure/sealed.ts,src/features/disclosure/rules.ts - Tests:
src/features/disclosure/disclosure.test.ts
T31. Leaked institution key file
Partial · Elevation of privilege
- Attack: A key file for PhilSys, the court or the issuer is copied from a server.
- Defense: Key files are created with mode 0600 and never committed; genesis carries public keys only; outside the lab the app cannot sign as an institution.
- Residual risk: No on-chain key rotation for institutions; no hardware security module support.
- Code:
src/features/chain/key-file.ts,src/features/chain/genesis-keys.ts - Tests:
src/features/chain/genesis-keys.test.ts
Economics
T32. Inflating the supply with fake people
Partial · Tampering
- Attack: Fake Soul IDs collect welcome grants and raise the validator reward, which scales with the number of people.
- Defense: Welcome lock, revocation that burns the grant and lowers the count of people, attester caps. Soul IDs with no activity for two years (dormant) stop counting toward the reward, so unreported deaths and abandoned fakes do not keep it high.
- Residual risk: Grants already spent before a revocation stay in circulation.
- Code:
src/features/chain/supply.ts,src/features/soul-id/rules.ts,src/features/life/rules.ts - Tests:
src/features/attesters/fake-soul.test.ts,src/features/economics/simulate.test.ts,src/features/life/life.test.ts
T42. Quietly changing the money rules
Partial · Tampering
- Attack: A developer, maintainer or node operator edits the welcome grant, reward, halving or burn numbers in the code to mint more NEL for themselves or slow the burn.
- Defense: The supply rules of testnet and mainnet have a fingerprint written in the code. A node whose numbers do not match refuses to start, refuses a saved chain made under other rules, and does not sync from peers that report other rules; a test fails as well. Any change shows up as an edit of the locked fingerprint in the diff, and only takes effect if node operators choose to run it (a hard fork).
- Residual risk: The fingerprint covers the declared numbers and the name of the burn-cap formula, not the code of every formula; reviewers and the economics tests guard the formulas themselves.
- Code:
src/features/supply-rules/rules.ts,src/features/network/node.ts,src/features/network/storage.ts - Tests:
src/features/supply-rules/rules.test.ts,src/features/network/storage.test.ts
T39. Overcharging fees paid in pesos
Mitigated · Tampering
- Attack: Someone moves the exchange pool's price just before a peso-paying user's transaction so that the NEL fee costs many more pesos.
- Defense: The sender signs the largest peso fee they accept (maxFeePhp); if buying the NEL fee would cost more, the transaction is rejected instead of charged. The field is part of the signature only when used, so older transactions keep their hashes.
- Residual risk: none known.
- Code:
src/features/exchange/fee-in-php.ts,src/features/chain/state.ts,src/features/chain/transaction.ts - Tests:
src/features/exchange/fee-in-php.test.ts
T33. Front-running swaps
Partial · Tampering
- Attack: A proposer reorders or inserts swaps around a user's swap to move the price against them.
- Defense: Every swap carries a minimum amount out; the secret, rotating proposer limits repeated abuse.
- Residual risk: Within its own block a proposer can still order transactions as it likes.
- Code:
src/features/exchange/rules.ts,src/features/exchange/amm.ts - Tests:
src/features/exchange/exchange.test.ts
Audit checklist
Items an external auditor should verify. None has been checked by an outside party yet.
- A01 (Ledger) Replaying the same chain on two machines gives the same state, including after a restart from disk. Where:
src/features/chain/verify.ts,src/features/network/storage.ts. - A02 (Ledger) Every transaction type has exactly one path in applyTx, and unknown types are rejected. Where:
src/features/chain/state.ts. - A03 (Ledger) All amounts are integers in units; no floating point, overflow or negative balance is reachable. Where:
src/features/chain/state.ts,src/features/chain/units.ts. - A04 (Ledger) Signatures and owner checks run before any state change, for every key scheme (Ed25519, ML-DSA, passkey). Where:
src/features/chain/transaction.ts,src/features/safety/rules.ts. - A05 (Economics) At every block boundary, counted supply (people + validators − burned) equals the sum of all balances, stakes, the exchange pool, unbonding coins, attester bonds and estates. Where:
src/features/chain/supply.ts. - A06 (Consensus) Votes are counted only from members drawn by a valid VRF proof, once per member, with the threshold floor(2E/3) + 1. Where:
src/features/consensus/votes.ts,src/features/consensus/committee.ts. - A07 (Consensus) Proposer tickets and evidence of double votes can be verified by anyone from public data. Where:
src/features/consensus/consensus.ts,src/features/consensus/slashing.ts. - A08 (Network) Every inbound message type has a shape check, and peer-only messages are refused from clients. Where:
src/features/network/validate-message.ts,src/features/network/server.ts. - A09 (Network) The secret-connection handshake binds both ephemeral keys and both identities, and nonces never repeat. Where:
src/features/network/secret-connection.ts. - A10 (Institutions) Secret keys and the identity salt are never logged, sent, or written outside keys/ with mode 0600. Where:
src/features/chain/key-file.ts,scripts/keygen.ts. - A11 (Wallet and users) Wallet secrets are stored only encrypted, and the Content-Security-Policy is present on every page and as strict as the framework allows (T28). Where:
src/features/wallet-app/secure-storage.ts,src/features/security/headers.ts. - A12 (Economics) Mainnet parameters match the whitepaper (an automated test covers the main numbers). Where:
src/features/chain/params.ts,src/features/whitepaper/whitepaper.test.ts. - A13 (Ledger) Dependencies are pinned in package-lock.json and pass npm audit; cryptography comes only from the audited noble libraries. Where:
package.json. - A14 (Consensus) Plan for upgrades: blocks carry no protocol version, so every rule change is a coordinated hard fork. Where:
src/features/chain/block.ts.