This work is aimed at understanding the amplification and confinement of electromagnetic fields in open sub-wavelength metallic cavities. We present a theoretical study of the electromagnetic diffraction by a perfectly conducting planar interface, which contains a sub-wavelength rectangular cavity. We derive a rigorous asymptotic of the Green function associated with the Helmholtz operator when the width of the cavity shrinks to zero. We show that the limiting Green function is that of a perfectly conducting plane with a dipole in place of the cavity. We give an explicit description of the effective dipole in terms of the wavelength and of the geometry of the cavity. Copyright (C) 2009 John Wiley & Sons, Ltd.