The solar abundances of Fe and of the CNO elements play an important role in addressing a number of important issues such as the formation, structure, and evolution of the Sun and the solar system, the origin of the chemical elements, and the evolution of stars and galaxies. Despite the large number of papers published on this issue, debates about the solar abundances of these elements continue. The aim of the present investigation is to quantify the impact of photospheric magnetic fields on the determination of the solar chemical abundances. To this end, we used two 3D snapshot models of the quiet solar photosphere with a different magnetization taken from recent magneto-convection simulations with small-scale dynamo action. Using such 3D models we have carried out spectral synthesis for a large set of Fei, Ci, Ni, and Oi lines, in order to derive abundance corrections caused by the magnetic, Zeeman broadening of the intensity profiles and the magnetically induced changes of the photospheric temperature structure. We find that if the magnetism of the quiet solar photosphere is mainly produced by a small-scale dynamo, then its impact on the determination of the abundances of iron, carbon, nitrogen and oxygen is negligible.