It looks like a mess involving the installation of a "B-vent" gas flue, through an existing stove pipe. The white caulk was probably an attempt to solve the problem previously. It also appears, and I certainly could be wrong, that the B vent is installed upside down, since the flange is arranged that it would appear to collect water. Look up B-vent, download an installation manual and try to determine how badly that whole mess has been kludged together. If it's reasonably safe, the addition of two storm collars, one above the first caulked up mess, and another above the second, should eliminate the leak.