Here is an old post of mine on a similar question:
1859 Mortal sin requires full knowledge and complete consent. It presupposes knowledge of the sinful character of the act, of its opposition to God’s law. It also implies a consent sufficiently deliberate to be a personal choice. Feigned ignorance and hardness of heart133 do not diminish, but rather increase, the voluntary character of a sin.
1860 Unintentional ignorance can diminish or even remove the imputability of a grave offense. But no one is deemed to be ignorant of the principles of the moral law, which are written in the conscience of every man. The promptings of feelings and passions can also diminish the voluntary and free character of the offense, as can external pressures or pathological disorders. Sin committed through malice, by deliberate choice of evil, is the gravest.
Note that it says knowledge of the sinful character of the act…not that the Church has taught it, but just that you know it is wrong. And then in the next section that “no one is deemed to be ignorant of the principles of the moral law”, showing that we don’t need the Church to teach us basic moral pricniples, they are inherent and everyone knows the basis rights and wrongs. So you have sins like murder, adultery, theft, etc that essentially every society in human history has condemned and every person knows in their own conscience to be wrong.