Everyone sins, and everyone needs the sacrifice of Jesus Christ, as Paul explains in Romans 5. Cain had a built-in sense of right and wrong. He knew that his attitude toward his brother was wrong. God told Cain to resist the sinful nature, but instead he allowed it to rule over him, and he murdered his brother. This was a sin, even though no written law said it was.
All normal humans have a conscience, a natural inbuilt sense of right and wrong.
By nature, God has written a moral sense, a law, into human hearts. Their understanding of right and wrong is not perfect, but every sane person has at least a basic concept of right and wrong, of love and selfishness. Although everyone falls short, some people do have good behavior as compared to others. Although many people try to do what they think to be right, none is perfect. Many others choose to live selfishly, violating the standards of their societies.