What are the notions of ethical hacking in Islam? Are they allowed?

It is quite evident that Islam has a great influence on ones privacy and encourages to respect it.

O you who have believed, avoid much [negative] assumption. Indeed, some assumption is sin. And do not spy or backbite each other. Would one of you like to eat the flesh of his brother when dead? You would detest it. And fear Allah ; indeed, Allah is Accepting of repentance and Merciful.

Also it is a sin to intrude and spy without their knowledge.

So is it really permissible if ethical hacking is done for good intentions (as it is suggested from its name)? Or does the user need to know that he is being 'under a test' etc? If so, what are the things we need to be careful of to be on the safe side?

Please note that ethical hacking does not always include compromising a users privacy. Some argue that it is also related to "Social engineering" which includes "tricking" the user under deliberate means maybe for testing security patterns or whatsoever. (I don't know if I'm being overly imaginative here, lol).

Recently, facebook is offering bounty for finding security vulnerabilities and this may require people to use methods of ethical hacking to find exploits and such exploits, I believe, has a huge potential of having other users private data to be exposed. Can we participate in such things or should we give utmost importance to the privacy of the users?

Also, I am quite aware that it is halaal if a company employs this method to find its own flaws (aka Penetration testing etc)

  • An analogy for one aspect of ethical hacking would be giving someone the right to come inside your house, regardless of methods used to enter the house. Jun 26, 2012 at 6:42
  • If you do not disclose vulnerabilities to anyone other than Facebook (before they fix them), and Facebook is inviting people to hack for them, then my analogy above is still applicable. (Also assuming you don't mess with users' data/etc and abide by the principles of ethical hacking.) Jun 26, 2012 at 6:49
  • @Flimzy I am aware of the difference, but ethical hacking, the phrase on a whole is already established to be similar to the cracker term and is not wrong afaik.
    – user123
    Jun 27, 2012 at 4:59

2 Answers 2


I see this as a special case of hiding someone's faults. By ethical hacking you are uncovering faults and helping someone. Weather you do it for Allah's blessing or money is material only towards the kind of Ajar/Blessings you will get, but the basic gist/intention/niyyah remains that it is a help.

You could just as easily exploit the weakness for a bigger sum of money for their enemies.


Abu Hurairah narrates that the Prophet said: "One who helped someone in a trouble in this world, Allah will help him in his trouble in the Hereafter and one who keeps the faults of a Muslim secret in this world, Allah will keep his faults in the Hereafter and Allah remains in the help of the (Muslim) man until he is in the help of his brother." (Musnad Ahmad: 274/2)


Ethical hacking AKA white hat hacking differs from illegal hacking AKA black hat hacking in that you are actually asked by the target and given permission by them to hack. In your example, Facebook are offering you money if you find a security hole that can be exploited. Thus, there is an agreement between the two parties on what is permissible (and what is not). And since there is agreement then there is nothing Haraam about it.

Ibn 'Umar (Allah be pleased with them) reported Allah's Messenger (may peace be upon him) as saying : Both parties in a business transaction have the right to annul it so long as they have not separated; except in transactions which have been made subject to the right of parties to annul them.

Saheeh Muslim: Book 10, Number 3656

Please note that ethical hacking does not mean hacking into sites you politically or morally disagree with. That is a whole other gray colored area.

You must log in to answer this question.