Observations of clusters of galaxies show ubiquitous presence of X-ray cavities, presumably blown by the active galactic nuclei (AGN) jets. We consider magnetic field structures of these cavities. Stability requires that they contain both toroidal and poloidal magnetic fields, while realistic configurations should have vanishing magnetic field on the boundary. For axisymmetric configurations embedded in unmagnetized plasma, the continuity of poloidal and toroidal magnetic field components on the surface of the bubble then requires solving the elliptical Grad–Shafranov equation with both Dirichlet and Neumann boundary conditions. This leads to a double eigenvalue problem, relating the pressure gradients and the toroidal magnetic field to the radius of the bubble. We have found fully analytical stable solutions. This result is confirmed by numerical simulation. We present synthetic X-ray images and synchrotron emission profiles and we evaluate the rotation measure for radiation transversing the bubble.