The source of gravity is energy-momentum, not just mass. Light has energy-momentum so it is a source of gravity.