Thermodynamically consistent description of mass transfer in porous media by a singular surface