Cerebral arteriovenous malformation (AVM) is a congenital brain vessels pathology, in which the arterial and venous blood channels are connected by tangles of abnormal blood vessels. It is a dangerous disease that affects brain functioning causing the high risk of intracerebral haemorrhage. One of AVM treatment methods is embolization - the endovascular filling of the AVM vessel bundle with a special embolic agent. This method is widely used, but still in some cases is accompanied by intraoperative AVM vessels rupture. In this paper, the optimal scenario of AVM embolization is studied from the safety and effectiveness of the procedure point of view. The co-movement of blood and embolic agent in the AVM body is modelled on the basis of a one-dimensional two-phase filtration model. Optimal control problem with phase constraints arising from medicine is formulated and numerically solved. In numerical analysis, the monotone modification of the CABARET scheme is used. Optimal embolization model is constructed on the basis of real patients' clinical data collected during neurosurgical operations. For the special case of embolic agent, input admissible and optimal embolization scenarios were calculated.