Wipe the bathroom vent duct's surface with a rag soaked in mineral spirits, working from the roof or exterior wall's louver toward the bathroom ventilation fan. Remove all the oily film and debris that covers each section of duct.
Inspect the vent duct's joints for loose or missing duct tape, and repair each joint as needed with metal-backed duct tape. Ventilation ducts use metal-backed duct tape to hold each section together.
Put on safety glasses and leather work gloves.
Remove the lid from an aerosol can of expanding foam. Point the nozzle toward the attic and shake the can for five minutes.
Hold the aerosol can's nozzle 12 inches from the bath vent duct. Depress the nozzle, releasing the expanding foam from the aerosol can, and cover the entire vent duct with the expanding foam. Work from the vent duct's wall or roof louver toward the ventilation fan.
Let the expanding foam dry for 15 minutes. Inspect the bath vent duct for missing areas of expanding foam insulation. Fill any spots on the vent duct without foam insulation with the leftover expanding foam in the aerosol can.