We determine the sorption isotherm in the infiltration model of contaminated water into porous media. We assume that the contaminated water infiltrates into the dry porous media, flow through the sample and flows out at the other side of the sample. We suppose that the contaminant dissolved in the water reversibly adsorbs into the porous media. We use the Richards equation with van Genuchten relation between effective saturation and pressure head. Further, we use Fick’s law to model the contaminant transport in the water and arbitrary adsorption isotherm to model the evolution of the adsorption. By running the direct problem simulation, we obtain the “measurements” of the expelled water mass and its concentration. Then we “forget” the adsorption isotherm function. We solve this inverse problem by evaluating the gradient of the distance function (between “measured” and computed bottom contaminant flux) in an iterative way. We construct the gradient (variation) of the distance function by solving the corresponding dual system of partial differential equations.