We show that, in presence of isometries and non-trivial topology, the Einstein--Hilbert action is invariant under certain transformations of the metric which are not diffeomorphisms. These transformations are similar to the higher-form symmetries of field theories with p-form fields. In the context of toroidal Kaluza--Klein compactifications, we show that these symmetries give rise to some of the ``hidden symmetries'' (dualities) of the dimensionally-reduced theories.