It isn't, throughout the whole sweep and narrative of Scripture there is no comment on the practice whatsoever. None, zip, zero. Leviticus which goes into considerable and extensive detail of various forms of sexual immorality (including bestiality in regards to both men and women so the author clearly was aware of even the most depraved and out-there kinds of misuse of sexual activity) doesn't comment on it while commenting on adultery, fornication, incest, homosexuality, rape and bestiality. It isn't comment on anywhere else at all, and it wasn't as if they were blind to the practice during the various time periods in which the various books of Scripture were written, since historical and archaeological evidence fairly well documents that people did know of it (it even forms part of an ancient Egyptian creation story).
There have been attempts to attempt to interpret masturbation sex act of some kind and therefore since it's outside of marriage is therefore sinful (these have ranged for designating masturbation as adultery/fornication, or even homosexual and incest acts O_O). The reasoning behind such interpretations, besides the fact that they cancel each other out (an act is either some form of heterosexual adultery/fornication or homosexuality for instance, it can't be both), seems strained beyond any plausibility to me. Bluntly, apart from some form mutual masturbation, masturbation can't it seems to me to be defined as a sex act, and certainly Biblically speaking (which is what really matters here) sex and sexual interaction, intimacy and intercourse is something that is always done with someone else. This is true whether done faithfully in the context of marriage, or when it is misused, and being unfaithful to the marriage convent in the various forms of idolatrous and immoral sexual immorality listed (adultery, fornication, homosexuality or even the extremely dehumanizing activities such as incest, rape, bestiality etc). However, it is always something that either is done with someone or something else, or using and abusing someone or something else, even when it involves just coveting someone else, or some clearly immoral sexual activity (the lust of the heart Jesus spoke of such as in Mat 5:28, in which you already begin to be guilty of the act by wanting to commit it), as you are mentally and spiritually engaging immorally with another who is not your spouse. This act though still requires the desire with another, and of course clearly covers use of pornography, coveting and lusting after someone who isn't your wife/husband. Can masturbation be associated such activities, sure, but it isn't what is sinful, it's the act of lusting after another, or a sexually immoral activity, or both that makes it so, not the act of masturbation (your guilty whether you are masturbating in associating to this activity or not, something for us all the bear in mind and be careful of). So this was always a weak position, masturbation is not solo sex (there is no such thing, either Biblically speaking or medically speaking), it seems to be a case of those convinced that masturbation is clearly a sin, and then not finding Scripture addressing it, attempting to find ways to turn what the Scriptures do address into commenting on masturbation as well, but I just think these argument stretch the case far to far, and are not convincing at all (and I might add, add to Scripture, trying to help God out to be 'more clear' on some subjects, something some Pharisees in Jesus day did).
So God working through the authors of Scripture has not commented at all on this activity, now is this an oversight? Given who inspired Scripture, I don't think that's an option. Does someone need special insight into the Scriptures to gain the understanding about masturbation (of all things O_O ) ahh, yeah that kind of secret knowledge thing has no place in orthodox Christianity either. So I fall on the conclusion that masturbation is not an inherently sinful act. Can it be associated with acts that are, most definitely as I noted above, but it is those acts or attitudes which are sinful, not masturbation itself. Stimulation can come from mental fantasising sure, but it also can come around from a purely physical response to stimuli without any associated thoughts, particularly to acting as a release in a period of high sexual tension/pressure (and in such a case can help prevent lustful fantasises assault the mind). In such cases there is no sin that is being committed or risked that I can see, and it can act for some a necessary add to avoiding sin and temptation.
So it's a case where each single Christian needs to be truly honest before the Lord and to themselves, can you masturbate without it leading you into sexually immoral fantasises (due to past activities such a watching porn etc) or not? Does it act as a pure release, or is it a snare for you, it's something you need to be truly honest with yourself about, because if it will lead you astray you will be lead into destructive places and could harm you (though the grace of God is always there through King Jesus it shouldn't be played with, and it's better to avoid the harm of sin then be restored from it). However if the answer is yes, then there is no sin or harm that I can see from it, it is just something everyone needs to be truly honest before God about.