Webby's definition tells us nothing about what this stuff is used for. Cosmoline is a preservative and rustproofing agent, used by military organizations the world over in the Twentieth Century. It was used anytime said militaries or their contractors packed away metallic equipment for shipment or storage, inside packing materials. Although it is still used, other preservation technologies have mostly supplanted it in Western military use.
What this means practically is that the most likely way you'll run into the stuff is if you manage to get your hands on a military surplus firearm of some kind (or larger piece of metal gear). Generally, firearms are highly sensitive to rust damage, especially in the cheaper coatings that were available to large-scale military production of the 20th. In addition, firearms were often refurbished at an arsenal after years and miles of use, and those coatings (almost always regular blueing, as Parkerizing was more expensive, stainless steel parts way more expensive, and more modern options like Cerakote unavailable) weren't very effective at handling long-term water against the surface of the metal. Packing materials, on the other hand, are hygroscopic and tend to attract and then trap water, especially in long-term storage.
I have no idea what cosmoline looks like when it goes on. When you are trying to take it off, it looks like a hard and usually sticky brown gunk, and gunk is the best word for it, trust me. It can be removed using solvents like gasoline or brake cleaner, but a) remember to only do this outdoors, b) wear protective gear and c) don't get the solvents on the wood parts of your gun! A better way to remove it is to disassemble the fiream to remove the wood, then for the metal components flush them with very very hot (boiling) water. The water will heat the cosmoline to the point of fluidity, and it will run off the gun (eventually). The other reason for using boiling water is that once the gun is relatively warm, the water will evaporate fairly quickly, and you won't have to laboriously dry it in all its myraid secret spaces.
For wood, one method of removing cosmoline is heat. if you're just dealing with a few pieces, such as a rifle stock, you can either use a heat gun or even put the stock in a regular cooking oven at around 175-200 degrees F. Regularly, take it out and wipe the liquid Cosmoline off the wood. Caution is recommended, as this treatment will also 'sweat out' the tung oil or boiled linseed oil that was used to treat military stocks. Don't worry; that's one way restorers do it. Just make sure you re-treat your stock once you have the cosmoline entirely removed.
Cosmoline's MIL-SPEC is: MIL-C-11796C Class 3. You can buy it today as a relatively inexpensive rustproofer.