Hi Dave, good news is you bought the house one month ago there is something called right of disclosure at a closing plus there should be money left in an escrow account.
The piping showing in your picture is NOT galvanized
If you had a home inspection and they did not notify you of this problem you may be eligible for a monetary award.
The bad news is the Cast Iron bell and spigot in the picture that is passing though the cinder block (foundation wall) was not protected by a sleeve that is required in most decent plumbing codes, thus this could be part of the problem
The piping on the vertical is entering a combination fitting a Wye, 1/8th bend (45 deg) and it appears to be caulked into another fitting possibly another Wye then it passes through the cinder block wall.
You may have a simple enough problem of just having a plumber melt out the old joint and caulk in a new one using lead and oakum Or it could be the fitting that is corroded and in that case both fittings will have to be replaced and the cinder block opened possible trenching from above.
I normally do not give prices on the net but in this case I would tell you I would charge NO LESS then $3,700 not including restoration of the walls.
Good luck and do nothing until you talk to your lawyer who was at the closing