In several pathological conditions, such as coronavirus infections, multiple sclerosis, Alzheimer's and Parkinson's diseases, the physiological shape of axons is altered and a periodic sequence of bulges appears. Experimental evidences suggest that such morphological changes are caused by the disruption of the microtubules composing the cytoskeleton of the axon. In this paper, we develop a mathematical model of damaged axons based on the theory of continuum mechanics and nonlinear elasticity. The axon is described as a cylinder composed of an inner passive part, called axoplasm, and an outer active cortex, composed mainly of F-actin and able to contract thanks to myosin-II motors. Through a linear stability analysis we show that, as the shear modulus of the axoplasm diminishes due to the disruption of the cytoskeleton, the active contraction of the cortex makes the cylindrical configuration unstable to axisymmetric perturbations, leading to a beading pattern. Finally, the nonlinear evolution of the bifurcated branches is investigated through finite element simulations.