5. The sum of all real roots of the equation $\left|x^{2}-12 x+34\right|=2$ is ( ).
(A) 12
(B) 15
(C) 18
(D) 21
(E) 25
5. C.

From the problem, we know
$$
\begin{array}{l}
x^{2}-12 x+34= \pm 2 \\
\Rightarrow x_{1}=4, x_{2}=6, x_{3}=8 \\
\Rightarrow x_{1}+x_{2}+x_{3}=18 .
\end{array}
$$