The present invention provides systems and methods for occluding and/or embolizing a cavity within a patient by delivering a prepolymer material into or onto a cavity and forming an expanding foam within the cavity. The inventions methods are applicable to occluding a variety of cavities, including blood vessels, aneurysms, left arterial appendages, vascular malformations and the like.