CCC 2071 The commandments of the Decalogue, although accessible to reason alone, have been revealed. To attain a complete and certain understanding of the requirements of the natural law, sinful humanity needed this revelation:
A full explanation of the commandments of the Decalogue became necessary in the state of sin because the light of reason was obscured and the will had gone astray.1
We know God’s commandments through the divine revelation proposed to us in the Church, and through the voice of moral conscience.
1 St. Bonaventure, Comm. sent. 4, 37, 1, 3.