We present a blind method to determine the properties of a foreground contamination, given by a visibility mask, that affects a deep galaxy survey. Angular cross correlations of density fields in different redshift bins are expected to vanish (apart from a contribution due to lensing), but are sensitive to the presence of a foreground that modulates the flux limit across the sky. After formalizing the expected effect of a foreground mask on the measured galaxy density, under a linear, luminosity-dependent bias model for galaxies, we construct two estimators, based on the average or square average galaxy density in a given sky pixel along the line of sight, that single out the mask contribution if a sufficient number of independent redshift bins is available. These estimators are combined to give a reconstruction of the mask. We use Milky-Way reddening as a prototype for the mask. Using a set of 20 large mock catalogs covering 1/4-th of the sky and number-matched to Hα emitters to mimic an Euclid-like sample, we demonstrate that our method can reconstruct the mask and its angular clustering at scales l lesssim 100, beyond which the cosmological signal becomes dominant. The uncertainty of this reconstruction is quantified to be 1/3-rd of the sample variance of the signal. Such a reconstruction requires knowledge of the average and square average of the mask, but we show that it is possible to recover this information either from external models or internally from the data. It also relies on knowledge of how the impact of the foreground changes with redshift (due to the extinction curve in our case), but this can be tightly constrained by cross correlations of different redshift bins. The strong points of this blind reconstruction technique lies in the ability to find "unknown unknowns" that affect a survey, and in the facility to quantify, using sets of mock catalogs, how its uncertainty propagates to clustering measurements.