Bond duration in its basic deterministic form is a concept well understood. Its meaning in the context of a yield curve on a stochastic path is less well developed. We extend the basic idea to a stochastic setting. More precisely, we introduce the concept of stochastic duration as a Malliavin derivative in the direction of a stochastic yield surface modeled by the Musiela equation. Further, using this concept we also propose a mathematical framework for the construction of immunization strategies (or delta hedges) of portfolios of interest-rate-sensitive securities with respect to the fluctuation of the whole yield surface.