Context. Glycoaldehyde, ethylene glycol, and methyl formate are complex organic molecules that have been observed in dark molecular clouds. Because there is no efficient gas-phase route to produce these species, it is expected that a low-temperature surface route existst that does not require energetic processing. CO hydrogenation experiments at low temperatures showed that this is indeed the case. Glyoxal can form through recombination of two HCO radicals and is then further hydrogenated. Aims. Here we aim to constrain the methyl formate, glycolaldehyde, and ethylene glycol formation on the surface of interstellar dust grains through this cold and dark formation route. We also probe the dependence of the grain mantle composition on the initial gas-phase composition and the dust temperature. Methods. A full CO hydrogenation reaction network was built based on quantum chemical calculations for the rate constants and branching ratios. This network was used in combination with a microscopic kinetic Monte Carlo simulation to simulate ice chemistry, taking into account all positional information. After benchmarking the model against CO-hydrogenation experiments, simulations under molecular cloud conditions were performed. Results. Glycoaldehyde, ethylene glycol, and methyl formate are formed in all interstellar conditions we studied, even at temperatures as low as 8 K. This is because the HCO + HCO reaction can occur when HCO radicals are formed close to each other and do not require to diffuse. Relatively low abundances of methyl formate are formed. The final COM abundances depend more on the H-to-CO ratio and less on temperature. Only above 16 K, where CO build-up is less efficient, does temperature start to play a role. Molecular hydrogen is predominantly formed through abstraction reactions on the surface. The most important reaction leading to methanol is H2CO + CH3O → HCO + CH3OH. Our simulations are in agreement with observed COM ratios for mantles that have been formed at low temperatures.