The catechism of the Catholic Church list six specific sins against chastity, in order of increasing seriousness: (a) Lust, (b) Masturbation, (c) Fornication, (d) Pornography, (e) Prostitution, (f) Rape.
(A) “Lust is disordered desire for sexual pleasure. Sexual pleasure is morally disordered when sought for itself, isolated from procreative and unitive purposes” (CCC 2351)
Lust does not mean sexual pleasure as such, nor delight in it, nor the desire for it in its right context. Contrary to what the world thinks, the Church teaches that sexual pleasure is good, not evil. For God invented sex and its pleasure. ("The Creator God himself established that in the (“generative”) function, married spouses should experience pleasure and enjoyment of body and “spirit” (CCC 2362)
It is natural and right that great pleasure should accompany great things, and the human sexual act is a great thing because of its two great essential ends: (1) uniting man and woman in “one flesh” body and soul, in mutual self-giving; and (2) procreating new persons who bear Gods own image that will last forever. Its the closest man and woman comes to sharing Gods own power of creation.
The essence of sex itself, like any intelligently designed thing, is its end.
Lust, like any sin “must” be seen against the background of human sexual expression. Lust divorces the two things God designed to be together; it seeks the pleasure (“apart”) from the purpose.
No spontaneous thoughts and feelings can be sins until they are willed or consented to by the will. Thoughts and feelings of sexual arousal are not lust. Lust is willing the thoughts and feelings just for the soul purpose of selfish pleasure, without the purposes of the marriage union between husband and wife in their unselfish giving to one another for the purpose of procreation.
(B) By (“Masturbation”) it is to be understood as the deliberate stimulation of the genital organs in order to derive sexual pleasure for selfish purposes. Both the Magisterium of the Catholic Church, in the course of a constant tradition, and the moral sense of the faithful have been in no doubt and have firmly maintained that masturbation is an intrinsically and gravely disordered action. The deliberate us of the sexual faculty for whatever reason, outside of marriage is essentially contrary to its purpose (CCC 2352).
(“Masturbation”) is wrong for the same reason (“Lust”) is wrong, with the physical act now added to the mental act; "For here sexual pleasure is sought outside of the sexual relationship in the marriage union between a loving husband and wife…in which mutual self-giving and human procreation is achieved. (CCC 2352).
However; to form an equitable judgment about the subjects of moral responsibility one must take into account the affective (“Emotional”) immaturity, and force of acquired habit, the conditions of anxiety, or other psychological or social factors (CCC 2352).
Masturbation like Lust, is very common and in a sense “natural”. But; that no more makes it right, or innocent, than selfishness is made innocent by the fact that it is a common behavior among humans. The natural law is not derived from observing how people do in fact usually behave, but from how their human nature is to be fulfilled and respected.