Look for the cause of the leak. If there are pipes installed in the walls of the attic, verify that they are not cracked. If you notice that the insulation is wet, there may be some sort of roof damage. Keep in mind that if you notice water dripping from one particular point in the attic, the leak may originate at a point above because of the water traveling in a downward direction.
Inspect your roof. Use a ladder to climb high enough to see the area of the roof that is the source of the leak. Do not get on the roof because water damage to the shingles may cause you to fall through it or slip off your home. Signs of damage to the roof and/or shingles include missing granules from asphalt shingles, a pile of debris in the area of the leak, moss growth on the shingles, ice dams, gutters filled with debris and tears caused by a fallen object or an object installed on or through the roof, like ducts or a chimney.
Take measures to avoid further damage. If there is debris on the roof or in the gutters, remove it so water can roll off your roof more efficiently when it rains. If there is moss growth, use a moss pesticide, which you can purchase at a home improvement store. Remove ice dams by increasing the amount of heat that circulates in your attic and make sure the attic has proper ventilation. The heat will help melt the ice.
Control the leaking roof from inside the attic. After pinpointing the exact location of the leak, cut out the insulation in that section with a utility knife. Affix the thin straw that comes with a bottle of expanding foam to the nozzle and point it into the source of the leak. While wearing latex gloves, squeeze the trigger on the bottle of foam and fill the area that is the source of the leak with a bit of foam. Allow the foam to expand before applying more.