Cerebral arteriovenous malformation is a difficult, dangerous, and most frequently encountered vascular failure of development. It consists of vessels of very small diameter, which perform a discharge of blood from the artery to the vein. In this regard it can be adequately modeled using porous medium. Endovascular embolization of arteriovenous malformation is effective treatment of such pathologies. However, the danger of intraoperative rupture during embolization still exists. The purpose is to model this process and build an optimization algorithm for arteriovenous malformation embolization. To study the different embolization variants, the initial-boundary value problems, describing the process of embolization, were solved numerically by using a new modification of CABARET scheme. The essential moments of embolization process were modeled in our numerical experiments. This approach well reproduces the essential features of discontinuous two-phase flows, arising in the embolization problems. It can be used for further study on the process of embolization.