Magnetic wormholes and topological symmetry