  We prove that optimal control of light energy storage in disordered media can
be reached by wavefront shaping. For this purpose, we build an operator for
dwell-times from the scattering matrix, and characterize its full eigenvalue
distribution both numerically and analytically in the diffusive regime, where
the thickness $L$ of the medium is much larger than the mean free path $\ell$.
We show that the distribution has a finite support with a maximal dwell-time
larger than the most likely value by a factor $(L/\ell)^2\gg 1 $. This reveals
that the highest dwell-time eigenstates deposit more energy than the open
channels of the medium. Finally, we show that the dwell-time operator can be
used to store energy in resonant targets buried in complex media.
