I think it is the mastercylinder. because the pistion inside is letting the fluid leak from the front to the rear. there are two rubber rings inside and the front one is capable of building pressure but not keeping pressure. It leaks into the second area and thats where the foam is coming from. use a hand vacumm pump they work great. I have no air and a really solid peddle.