“sin crouches at the door.” The Hebrew word “sin,” usually a feminine noun, is constructed in the masculine here. Thus sin is personified as something of the male gender and may in this case even be a reference to the masculine noun, “serpent,” which occurs in Genesis 3. That sin is some kind of crouching creature, waiting to spring on its victim, is well portrayed by Everett Fox (The Schocken Bible: Volume 1, The Five Books of Moses). He translates verse 7, “If you intend good, bear-it-aloft, but if you do not intend good, at the entrance is sin, a crouching demon, toward you his lust—but you can rule over him.”
The NIV Study Bible text note on Genesis 4:7 says, “The Hebrew word for ‘crouching’ is the same as an ancient Babylonian word referring to an evil demon crouching at the door of a building to threaten the people inside.” Although the Devil and demons are always on the alert to be able to afflict people who turn away from God and godliness, there is an important truth in the Sin-Demon being at the door. Godly people can cleanse their houses of demonic materials and faithfully pray for the holiness and protection of their house, and that can keep demons from being able to enter, but demons may sometimes “wait at the door,” hanging around and waiting to find ways to afflict the inhabitants. God warned Cain about his sin and what could happen if he did not repent, but Cain ignored God’s warning and turned to the Devil for support and became “of that wicked one” (1 John 3:12). Cain committed the unforgivable sin, which is why he could not be forgiven, and he knew it (Gen. 4:13). [For more on the unforgivable sin, see commentary on Matt. 12:31].