Metals embedded in porous media interact electrochemically with the liquid phase contained in the pores. A widespread form of this, adversely affecting the integrity of engineered structures, is corrosion of steel in porous media or in natural environments. While it is well-documented that the rate of this electrochemical dissolution process can vary over several orders of magnitude, understanding the underlying mechanisms remains a critical challenge hampering the development of reliable predictive models. Here we study the electrochemical dissolution kinetics of steel in meso-to-macro-porous media, using cement-based materials, wood, and artificial soil as model systems. Our results reveal the dual role of the pore structure, that is, the influence on the electrochemical behavior through transport limitations and an area-effect, which is ultimately due to microscopic inhomogeneity of the metal-porous material interface. We rationalize the observations with the theory of capillary condensation and propose a material-independent model to predict the corrosion rate.