Assalamu aleykum,
Masturbation is undoubtedly a sin in Islam and it is not permitted in any circumstances.
As this verse of the Holy Qur’an states:
"And those who guard their chastity (i.e. private parts, from illegal sexual acts). Except from their wives or (the captives and slaves) that their right hands possess, - for them, they are free from blame. But whoever seeks beyond that, then those are the transgressors." (23:5-7)
To research further the Islamic view about masturbation and its consequences, please refer to the following texts:
- Philosophy of Islamic Laws by Ayatullah Naser Makarem Shirazi & Ayatullah Jafar Subhani, in particular question 27:
https://www.al-islam.org/philosophy-islamic-laws-nasir-makarim-shirazi-j...
- Marriage and Morals in Islam by Sayyid Muhammad Rizvi, Chapter 3: Islamic Sexual Morality 2
https://www.al-islam.org/marriage-and-morals-islam-sayyid-muhammad-rizvi...
- Youth and Spouse Selection, by Ali Akbar Mazaheri:
https://www.al-islam.org/youth-and-spouse-selection-ali-akbar-mazaheri/c...