8. Find all prime numbers $p$ such that there exists an integer-coefficient polynomial
$$
f(x)=x^{p-1}+a_{p-2} x^{p-2}+\cdots+a_{1} x+a_{0} \text {, }
$$

satisfying that $f(x)$ has $p-1$ consecutive positive integer roots, and $p^{2} \mid f(\mathrm{i}) f(-\mathrm{i})$, where $\mathrm{i}$ is the imaginary unit.
8. Let
$$
f(x)=(x-m)(x-m-1) \cdots(x-m-p+2) \text {, }
$$

where $m$ is a positive integer.
$$
\begin{array}{l}
\text { Then } f(i) f(-i) \\
\left.=\left[\prod_{k=m}^{m}+i-k\right)\right]\left[\prod_{k=m}^{m}(-i-k)\right] \\
=\prod_{k=m}^{m+2}\left(k^{2}+1\right) .
\end{array}
$$

By $p^{2} \mid f(i) f(-i)$, we know
$$
\left.p^{2}\right|^{m} \prod_{k=m}^{+p-2}\left(k^{2}+1\right) \text {. }
$$

If $p=2$, then equation (1) becomes $4 \left(m^{2}+1\right)$, which cannot hold for any positive integer $m$.

If the prime $p \equiv 3(\bmod 4)$, then -1 is not a quadratic residue modulo $p$.
Thus, there does not exist an integer $k$ such that
$$
k^{2}+1 \equiv 0(\bmod p) \text {. }
$$

Therefore, the right-hand side of equation (1) is not divisible by $p$.
In this case, $p$ does not satisfy the condition.
If the prime $p \equiv 1(\bmod 4)$, then -1 is a quadratic residue modulo $p$.
Thus, there exists $k_{1} \in\{1,2, \cdots, p-1\}$ such that
$$
k_{1}^{2}+1 \equiv 0(\bmod p) \text {. }
$$

Therefore, $\left(p-k_{1}\right)^{2}+1 \equiv 0(\bmod p)$, where $p-k_{1} \in\{1,2, \cdots, p-1\}$ and $p-k_{1} \neq k_{1}$.

Thus, $p^{2} \mid \prod_{k=1}^{p-1}\left(k^{2}+1\right)$, meaning equation (1) holds when $m=1$.

The above shows that primes $p \equiv 1(\bmod 4)$ satisfy the condition, and the corresponding polynomial $f(x)$ can be taken as
$$
f(x)=(x-1)(x-2) \cdots(x-p+1) .
$$

In summary, the primes $p$ that satisfy the condition are all primes congruent to 1 modulo 4.