[proofplan]
The Hamiltonian maximization condition can be reduced to maximizing only the part of the Hamiltonian that depends on the control. That part is the linear functional $v \mapsto (B^\top p(t)) \cdot v$ on the product box $U$. A linear functional on a box is maximized coordinatewise: a positive coefficient forces the upper endpoint and a negative coefficient forces the lower endpoint. Finally, if the zero sets of all switching functions consist only of isolated points, those exceptional times form a finite union of countable null sets, so the endpoint rule holds almost everywhere for every component.
[/proofplan]
[step:Reduce Hamiltonian maximization to coordinatewise maximization of a linear functional]
Let $E \subset [0,T]$ denote the set of times $t$ for which the Hamiltonian maximization condition holds. By hypothesis, $\mathcal{L}^1([0,T]\setminus E)=0$.
Define the coefficient map $c: [0,T] \to \mathbb{R}^m$ by
\begin{align*}
c(t) := B^\top p(t)
\end{align*}
for each $t \in [0,T]$. Thus $c_i(t)=\varphi_i(t)$ for each $i \in \{1,\dots,m\}$. Fix $t \in E$. For every $v \in U$,
\begin{align*}
H(x^*(t),v,p(t)) = p(t)\cdot Ax^*(t) + p(t)\cdot Bv - 1.
\end{align*}
Using the identity $p(t)\cdot Bv = (B^\top p(t))\cdot v = c(t)\cdot v$, this becomes
\begin{align*}
H(x^*(t),v,p(t)) = p(t)\cdot Ax^*(t) - 1 + c(t)\cdot v.
\end{align*}
The term $p(t)\cdot Ax^*(t)-1$ is independent of $v$. Hence the maximization condition at time $t$ is equivalent to
\begin{align*}
c(t)\cdot u^*(t) = \max_{v \in U} c(t)\cdot v.
\end{align*}
[/step]
[step:Force the upper endpoint when the switching coefficient is positive]
Fix $i \in \{1,\dots,m\}$ and fix $t \in E$ such that $\varphi_i(t)>0$. Since $u^*(t) \in U$, each component satisfies $u_j^*(t) \in [a_j,b_j]$. Suppose, for contradiction, that $u_i^*(t) < b_i$.
Define $w \in \mathbb{R}^m$ by setting $w_i := b_i$ and $w_j := u_j^*(t)$ for every $j \in \{1,\dots,m\}$ with $j \ne i$. Then $w \in U$, because $b_i \in [a_i,b_i]$ and the remaining components agree with those of $u^*(t) \in U$. Since $c_i(t)=\varphi_i(t)>0$, we compute
\begin{align*}
c(t)\cdot w - c(t)\cdot u^*(t) = c_i(t)(b_i-u_i^*(t)) > 0.
\end{align*}
This contradicts the maximality of $u^*(t)$ for the linear functional $v \mapsto c(t)\cdot v$ on $U$. Therefore $u_i^*(t)=b_i$.
[guided]
Fix a component index $i \in \{1,\dots,m\}$ and a time $t \in E$ such that $\varphi_i(t)>0$. The goal is to show that the $i$-th component of the maximizing control cannot sit anywhere below the upper endpoint $b_i$.
At this time $t$, the previous step gives
\begin{align*}
c(t)\cdot u^*(t) = \max_{v \in U} c(t)\cdot v,
\end{align*}
where $c(t)=B^\top p(t)$ and $c_i(t)=\varphi_i(t)$. Since $\varphi_i(t)>0$, increasing the $i$-th coordinate of a candidate control increases the value of the linear functional $v \mapsto c(t)\cdot v$, provided all other coordinates are kept fixed.
Assume, toward a contradiction, that $u_i^*(t)<b_i$. Define a competitor $w \in \mathbb{R}^m$ by changing only the $i$-th coordinate of $u^*(t)$ to the upper endpoint:
\begin{align*}
w_i := b_i.
\end{align*}
For every $j \in \{1,\dots,m\}$ with $j \ne i$, define
\begin{align*}
w_j := u_j^*(t).
\end{align*}
This vector belongs to $U$ because the $i$-th coordinate equals $b_i \in [a_i,b_i]$, and every other coordinate remains in its interval $[a_j,b_j]$ since $u^*(t)\in U$.
Now compare the linear objective at $w$ and at $u^*(t)$. All coordinates except the $i$-th cancel, so
\begin{align*}
c(t)\cdot w - c(t)\cdot u^*(t) = c_i(t)(w_i-u_i^*(t)).
\end{align*}
Using $w_i=b_i$ and $c_i(t)=\varphi_i(t)>0$, this gives
\begin{align*}
c(t)\cdot w - c(t)\cdot u^*(t) = c_i(t)(b_i-u_i^*(t)) > 0.
\end{align*}
Thus $c(t)\cdot w > c(t)\cdot u^*(t)$, contradicting the fact that $u^*(t)$ maximizes $v \mapsto c(t)\cdot v$ over $U$. Hence the assumption $u_i^*(t)<b_i$ is impossible, and therefore $u_i^*(t)=b_i$.
[/guided]
[/step]
[step:Force the lower endpoint when the switching coefficient is negative]
Fix $i \in \{1,\dots,m\}$ and fix $t \in E$ such that $\varphi_i(t)<0$. Suppose, for contradiction, that $u_i^*(t)>a_i$.
Define $w \in \mathbb{R}^m$ by setting $w_i := a_i$ and $w_j := u_j^*(t)$ for every $j \in \{1,\dots,m\}$ with $j \ne i$. Then $w \in U$. Since $c_i(t)=\varphi_i(t)<0$ and $a_i-u_i^*(t)<0$, we have
\begin{align*}
c(t)\cdot w - c(t)\cdot u^*(t) = c_i(t)(a_i-u_i^*(t)) > 0.
\end{align*}
This contradicts the maximality of $u^*(t)$ over $U$. Therefore $u_i^*(t)=a_i$.
[/step]
[step:Remove the zero switching times under the isolated-zero hypothesis]
Assume now that, for each $i \in \{1,\dots,m\}$, the set
\begin{align*}
Z_i := \{t \in [0,T] : \varphi_i(t)=0\}
\end{align*}
consists only of isolated points.
[claim:Each isolated zero set is countable and has Lebesgue measure zero]
For every $i \in \{1,\dots,m\}$, the set $Z_i$ is countable and satisfies $\mathcal{L}^1(Z_i)=0$.
[/claim]
[proof]
Fix $i \in \{1,\dots,m\}$. Since every point of $Z_i$ is isolated in the relative topology of $[0,T]$, for each $s \in Z_i$ there exists an open interval $I_s \subset \mathbb{R}$ such that
\begin{align*}
I_s \cap [0,T] \cap Z_i = \{s\}.
\end{align*}
Choose rational numbers $r_s,q_s \in \mathbb{Q}$ with $r_s < s < q_s$ and $(r_s,q_s) \subset I_s$ whenever $s \in (0,T)$. At the endpoints $0$ and $T$, if they belong to $Z_i$, record them separately; this adds at most two points.
The assignment $s \mapsto (r_s,q_s)$ is injective on $Z_i \cap (0,T)$, because if two distinct points of $Z_i$ were assigned the same rational interval, that interval would contain two points of $Z_i$, contradicting the defining isolation property. Since $\mathbb{Q}\times\mathbb{Q}$ is countable, $Z_i \cap (0,T)$ is countable, and hence $Z_i$ is countable.
Enumerate $Z_i$ as $\{s_k : k \in \mathbb{N}\}$ if it is infinite, with the finite case handled by the same argument after repeating points harmlessly. For any $\varepsilon>0$, cover each $s_k$ by the open interval
\begin{align*}
J_k := \left(s_k-\frac{\varepsilon}{2^{k+2}}, s_k+\frac{\varepsilon}{2^{k+2}}\right).
\end{align*}
Then $Z_i \subset \bigcup_{k=1}^{\infty} J_k$, and the total length of this cover is at most
\begin{align*}
\sum_{k=1}^{\infty} \frac{\varepsilon}{2^{k+1}} \le \varepsilon.
\end{align*}
Since $\varepsilon>0$ was arbitrary, $\mathcal{L}^1(Z_i)=0$.
[/proof]
Define the exceptional set $N \subset [0,T]$ by
\begin{align*}
N := ([0,T]\setminus E) \cup \bigcup_{i=1}^{m} Z_i.
\end{align*}
The set $[0,T]\setminus E$ has $\mathcal{L}^1$-measure zero by definition of $E$, and each $Z_i$ has $\mathcal{L}^1$-measure zero by the claim. Since $m$ is finite, $\mathcal{L}^1(N)=0$.
[/step]
[step:Conclude that the control takes values in the box vertices almost everywhere]
Let $t \in [0,T]\setminus N$. Then $t \in E$ and, for every $i \in \{1,\dots,m\}$, one has $\varphi_i(t)\ne 0$. Applying the endpoint rules proved above, each component satisfies
\begin{align*}
u_i^*(t)=b_i \quad \text{if } \varphi_i(t)>0,
\end{align*}
and
\begin{align*}
u_i^*(t)=a_i \quad \text{if } \varphi_i(t)<0.
\end{align*}
Thus $u_i^*(t)\in \{a_i,b_i\}$ for every component $i$. Since $\mathcal{L}^1(N)=0$, this holds for $\mathcal{L}^1$-almost every $t \in [0,T]$. Therefore $u^*$ is bang-bang in the stated almost-everywhere sense.
[/step]