There are several genera of bacteria that produce desert varnish. The bacteria lies between the varnish and the rock. The bacteria pulls manganese and iron from the atmosphere and precipitate it as the varnish. They also cement a thin layer of clay with the varnish to create a protective layer against extreme weather conditions. The oxidation of the metals is how the bacteria "feeds," hence the "rusting" on the rocks.