Files
papers/lux-bridge/sections/09-contract-security-hardening.tex
zeekay 9504b4c3ef papers: cover-consistency + build pass on Lux Tier-2/3 catalogue
Sweep across the non-Tier-1 paper catalogue (Tier-1 owned by parallel
agent and excluded). All 113 processed papers already had luxcover
wired up; this commit fixes 14 build breakers and produces fresh
PDFs across the catalogue.

Fixes:
- lux-blockchain-scaling-laws: em-dash inside lstlisting -> --
- lux-corona-pq: stale \input pointing at 03-the-corona-scheme renamed
  to 03-the-corona-scheme (file already renamed on disk)
- lux-lattice-cryptography-primer: same Corona->Corona rename
- lux-formal-verification-lean4: Lean source uses unicode (×, ∀, ∃, ∈,
  ∧, ∨, ∩, ≠, ⟨, ⟩, ·, ¬) inside lstlistings. Added a literate map
  so listings render the math glyphs without UTF-8 fault.
- lux-id-did-specification: ✓/✗ in tabular replaced with \ding{51}
  / \ding{55} (pifont). Added pifont package.
- lux-ntt-simd-implementation: middle-dot in Go assembly listings;
  added literate {·}{\textperiodcentered}.
- lux-ntt-transform: μ, ×, –, — in regular text (no T1 fontenc).
  Replaced with $\mu$/$\times$/--/--- via unicode->latex sweep.
- lux-perpetuals-derivatives, lux-quantum-consensus,
  lux-quasar-consensus, lux-tee-computing-mesh: same unicode->latex
  sweep across body text. Also fixed broken math segment
  `$L_{avg} = 10$\times$$` -> `$L_{avg} = 10\times$`.
- lux-zchain: emoji glyphs in roadmap table replaced with
  parenthetical text.
- lux-triple-proof-consensus: dropped duplicate \usepackage{geometry}
  that clashed with luxcover (geometry option clash).
- pq: defined missing \Rq macro.

PDFs rebuilt for the full Tier-2/3 set.

Excluded (Tier-1, parallel agent): lp-073-pulsar, lp-stricte2epq,
dag-evm-formal, lp-010-quasar-stm-{3,4}, lp-020-quasar-consensus,
lux-institutional-custody, lux-nist-mptc-submission, pqsafe-il5,
pq-rns, plus shared/ and lps/.
2026-05-13 01:27:59 -07:00

84 lines
4.1 KiB
TeX

\section{Contract Security Hardening}
\label{sec:contract-security}
%% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Four critical vulnerabilities were identified and fixed in the bridge smart contracts during the 2025 security audit. Each fix is verified by Halmos symbolic proofs.
\subsection{C-01: Daily Mint Limits}
\textbf{Vulnerability}: The \texttt{bridgeMint()} function in \texttt{LRC20B.sol} had no rate limiting. A compromised MPC key could mint unlimited tokens in a single transaction.
\textbf{Fix}: Enforced configurable daily mint limits with automatic period reset.
\begin{algorithm}[H]
\caption{C-01: Rate-Limited Bridge Mint}
\begin{algorithmic}[1]
\Function{bridgeMint}{$\text{account}, \text{amount}$}
\State \textbf{require} $\text{hasRole}(\texttt{MINTER\_ROLE}, \text{msg.sender})$ \Comment{C-02}
\If{$\text{block.timestamp} \geq \text{mintPeriodStart} + \texttt{1 day}$}
\State $\text{dailyMinted} \gets 0$
\State $\text{mintPeriodStart} \gets \text{block.timestamp}$
\EndIf
\If{$\text{dailyMintLimit} > 0$}
\State \textbf{require} $\text{dailyMinted} + \text{amount} \leq \text{dailyMintLimit}$ \Comment{Revert: \texttt{MintLimitExceeded}}
\State $\text{dailyMinted} \mathrel{+}= \text{amount}$
\EndIf
\State $\text{\_mint}(\text{account}, \text{amount})$
\EndFunction
\end{algorithmic}
\end{algorithm}
\textbf{Halmos verification}: \texttt{check\_bridgeMint\_daily\_limit} proves that $\forall a, b$: if $\text{dailyMinted} + a \leq L$ and $\text{dailyMinted} + b \leq L$, then $\text{dailyMinted} + a + b \leq 2L$ (no overflow bypass).
\subsection{C-02: MINTER\_ROLE Separation}
\textbf{Vulnerability}: Bridge minting was gated by \texttt{DEFAULT\_ADMIN\_ROLE}. A compromised admin could both mint tokens and grant new admins, creating a single point of failure.
\textbf{Fix}: Introduced a separate \texttt{MINTER\_ROLE} ($\texttt{keccak256("MINTER\_ROLE")}$) with explicit \texttt{grantMinter()} / \texttt{revokeMinter()} management. Admin and minter are orthogonal capabilities.
\textbf{Invariant}: $\texttt{MINTER\_ROLE} \neq \texttt{DEFAULT\_ADMIN\_ROLE}$ and no function grants both roles atomically.
\subsection{C-03: Monotonic MPC Nonce}
\textbf{Vulnerability}: MPC-signed messages used \texttt{block.timestamp} as the nonce, which is manipulable by validators within the 15-second tolerance window and is not guaranteed unique across chains.
\textbf{Fix}: Replaced with a strictly monotonic counter nonce per bridge contract:
\begin{equation}
\text{nonce}_{i+1} = \text{nonce}_i + 1, \quad \text{nonce}_0 = 0
\end{equation}
\textbf{Property}: Nonce monotonicity guarantees replay protection without relying on block timestamps. The MPC committee signs $H(\text{chainId} \| \text{nonce} \| \text{payload})$.
\subsection{C-04: Sequential Withdraw Nonce}
\textbf{Vulnerability}: Withdraw operations used $H(\text{sender} \| \text{amount} \| \text{block.timestamp})$ as the nonce, which is predictable and allows front-running: an attacker observing a pending withdrawal can compute its nonce and submit a conflicting transaction.
\textbf{Fix}: Replaced with a per-user sequential counter:
\begin{equation}
\text{withdrawNonce}[\text{user}]_{i+1} = \text{withdrawNonce}[\text{user}]_i + 1
\end{equation}
\textbf{Property}: Sequential nonces are unpredictable to third parties (the next valid nonce for user $u$ is $\text{withdrawNonce}[u]$, which requires knowing the current state).
\subsection{Security Fix Summary}
\begin{table}[h]
\centering
\begin{tabular}{llll}
\toprule
\textbf{ID} & \textbf{Severity} & \textbf{Vulnerability} & \textbf{Fix} \\
\midrule
C-01 & Critical & Unlimited \texttt{bridgeMint()} & Daily mint limits \\
C-02 & Critical & Admin = Minter role conflation & Separate \texttt{MINTER\_ROLE} \\
C-03 & Critical & Timestamp-based MPC nonce & Monotonic counter nonce \\
C-04 & High & Predictable withdraw nonce & Sequential per-user nonce \\
\bottomrule
\end{tabular}
\caption{Bridge contract security fixes (2025 audit)}
\label{tab:security-fixes}
\end{table}
%% +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++