Sounds like anal glands. They are normally expressed when your cat has a bowel movement but can express spotaneously if they are full. You can have your vet express them on a regular basis to prevent "surprises" or get him/her to show you how to do it yourself. (Most people opt for the forst option
) If you notice your cat "scooting" or licking his/her bum obsessively you might want to get it looked at as they can become impacted and infected.