4:7

הֲלוֹא אִם־תֵּיטִיב שְׂאֵת וְאִם לֹא תֵיטִיב לַפֶּתַח חַטָּאת רֹבֵץ וְאֵלֶיךָ תְּשׁוּקָתוֹ וְאַתָּה תִּמְשָׁל־בּוֹ׃

Surely, if you do good, you will be lifted up. And if you do not do good, sin crouches at the door. Its desire is for you, but you can rule over it."

Bereshit 4:7

הֲלוֹא אִם־תֵּיטִיב שְׂאֵת

Bereshit / Genesis 4:7 · Sod

Bereshit 4:7

הֲלוֹא אִם־תֵּיטִיב שְׂאֵת וְאִם לֹא תֵיטִיב לַפֶּתַח חַטָּאת רֹבֵץ וְאֵלֶיךָ תְּשׁוּקָתוֹ וְאַתָּה תִּמְשָׁל־בּוֹ׃

Surely, if you do good, you will be lifted up. And if you do not do good, sin crouches at the door. Its desire is for you, but you can rule over it."

Sod סוֹד

Return is in your hand

The hardest thing about a mistake is the thought that there is no way back. Ramban reads the last words of the verse as the Torah's first promise: one can return at any hour. And the Zohar shows which "door" is meant.

Ramban explains: the evil inclination will long to cleave to you all your days, but you will rule over it if you wish to mend your ways and cast it off. With this the Almighty taught Kayin (Cain) return (תְּשׁוּבָה): it is given into a person's hand, one can return at any time one wishes, and he will be forgiven. The Zohar reads "the door" (פֶּתַח) as the door above, from which the judgements for the evil deeds of the world go out, "open for me the gates of righteousness", and "sin lies" at that door is the angel of death, who waits to exact payment from you.

How Ramban and Zohar explain it

Ramban And its desire is towards you

It will long to cleave to you all the days, but you will rule over it if you wish, because you will mend your ways and cast it off from you. With this He taught him return (תְּשׁוּבָה): it is given into his hand to return at any time he wishes, and He will forgive him.

Zohar Sin lies at the door

What is "at the door"? This is the door above, from which the judgements for the evil deeds of the world go out. "Door", as it is said: "open for me the gates of righteousness". And at that door "sin lies": this is the angel of death, and he is ready to exact payment from you.

Takeaway

Return (תְּשׁוּבָה): so the Torah and the sages call repentance, the turn from sin back to the Almighty. Ramban finds its first promise in the words "and you shall rule over it".
"To cleave to you" (דָּבֵק): Ramban's rendering of the verse's word "desire" (תְּשׁוּקָה). The evil inclination wants to cleave, and the power to cast it off is the person's.
"Open for me the gates of righteousness, I will enter them, I will praise the Eternal" (Tehillim / Psalms 118:19): the verse with which the Zohar explains the word "door" in our verse. The door above is the gate through which judgement goes out.
The angel of death (מַלְאַךְ הַמָּוֶת): in the words of the sages, the one who takes life. The Zohar identifies him with the sin that "lies at the door" and waits for payment.
In the next passage the Zohar explains why judgement waits exactly at the door: the first human was created on Rosh HaShanah, the day of judgement, and so came into the world under judgement (Zohar, Bereshit 46:2).