The basic principle with regard to such products that may be used for both halaal or haraam purposes is that reference should be make to knowledge and certainty about the purchaser or user.
If it is certain that they are going to be used for haraam purposes, then it is not permissible to produce them or sell them.
If it is certain that they are going to be used for permissible purposes, then there is no dispute that it is permissible to produce them and sell them.
If both are possible, and we do not know whether people will use them for halaal or haraam purposes, then we should act on the basis of what we think is most likely. If the producer or seller thinks it most likely that the buyer will use it for haraam purposes, then it is haraam to sell it to him. If he thinks it most likely that he will use it for halaal purposes then it is halaal to sell it to him.
Unfortunately if we study the stock market in the Arab and Muslim world – let alone the West – we will see that most of the shares that are bought and sold in those markets are shares in haraam companies such as banks, insurance companies and companies that make haraam products, and those that buy and sell permissible products take riba-based loans and invest their wealth in riba-based banks. These are what some contemporary scholars call “mixed companies” and companies whose shares are haraam according to the correct opinion.
Hence it is not permissible for anyone to help these stock markets with their work, because of the definitively haraam things that it involves, or because of the haraam that is mixed with halaal, and the halaal is very small in comparison with the haraam. Based on this, we do not think that you should work in marketing these programs, because it is cooperating in sin and transgression, and Allaah says (interpretation of the meaning):
“do not help one another in sin and transgression. And fear Allaah. Verily, Allaah is Severe in punishment”
Shaykh al-Islam Ibn Taymiyah (may Allaah have mercy on him) said:
Every garment that it is thought most likely will be used for sinful purposes, it is not permissible to sell or tailor it for one who is going to use it for sinful and wrong purposes. End quote.
Sharh al-‘Umdah (4/386).
In the answer to question no. 11517 we quoted the response of Shaykh Ibn al-‘Uthaymeen (may Allaah have mercy on him) (to a question) about the ruling on operating a computer program for a company that would use it for both halaal and haraam purposes. The Shaykh replied:
If most of the work which this company does is haraam, then it is not permissible for him to do that. If most of what they do is permitted, then it is permissible for him to do it. If they (haraam and halaal elements) are the same, then he should not do it, on the assumption that what is haraam will outweigh what is halaal. And Allaah knows best.
For more information, please see the answer to question no. 75007.
And Allaah knows best.