How do hackers hack websites?
Published: 2021-05-03 05:44:50

In the movies, hacking is like fast keyboard typing and hitting the Enter but in the real world, hackers find and exploit vulnerabilities to hack websites.

## What is a web vulnerability?
There are different definitions for vulnerability. According to [ISO 27005](https://en.wikipedia.org/wiki/ISO/IEC_27005) a vulnerability is:

> *“A weakness of an asset or group of assets that can be exploited by one or more threats, where an asset is anything that has value to the organization, its business operations, and their continuity, including information resources that support the organization's mission”*

That means vulnerabilities can let the malicious user do actions they're not supposed to do.

## Common vulnerabilities hackers use for hacking websites
Here is the list of common web vulnerabilities.

### Passwords
You log in to your website using a password, so do hackers! Choose an easy password to make it easy for hackers to break into your website.
Hackers use methods like password guessing, brute force, and phishing to find passwords and break into any website.

Protect your secrets carefully to stop hackers.

### Known Vulnerabilities
Using an outdated WordPress plugin can let a hacker get into your website. 
Every day many vulnerabilities in popular web softwares are found and reported by security researchers. Once a vulnerability is reported hackers start finding vulnerable targets to exploit and hack for their purpose.

It's crucial to use the latest version of any software and install security updates as soon as possible.

### Cross-Site Scripting (XSS)
XSS doesn't allow hackers to access your website directly but hackers can manipulate what is presented on your website using this vulnerability. 

Cross Site Scripting is a dangerous vulnerability because hackers can control the browser of your website visitors and eventually gain access to your website by stealing your browser Cookie containing the access token to the website.

### Broken Access Control
What would happen if you have no authentication for the administration panel of your website? Your website will get hacked. This is one example of broken access control over the administration panel.

The access control can be broken in any sensitive functionalities like sending posts, uploading files, updating profile, etc. Broken access control is like an open door to your website for hackers.

### Injection Vulnerabilities
Web applications rely on executing commands for performing different actions like displaying your website items, searching, login, and other tasks. If these commands are build using user-supplied input, the web application might be vulnerable to injection attacks.

There many different types of injection vulnerabilities. Some of the more common injections are SQL, NoSQL, OS command, Object Relational Mapping (ORM), LDAP, and Expression Language (EL) or Object Graph Navigation Library (OGNL) injection.
Hacker uses these vulnerabilities to inject their commands to your website and hack it.

### Path Traversals
Hackers try to access files and directories outside of your website root folder. They try to inject dot-dot-slash (../)” sequences and their variations or absolute file paths wherever possible to access sensitive files like application source code and OS files to take over your website.

### Other Issues
There are many other ways to hack a website. For example, hacking the FTP server might end up hacking your whole website. Or, Hacking one website on a shared host can give access to other websites on that host. Also, the combination of two or more vulnerabilities can create a back door to your website.

Some other vulnerabilities for hacking websites are Cross Site Request Forgery (CSRF), having debug/sample codes on your website, leaving backup files under the web root, displaying detailed error messages, etc.

To keep your website secure, you should test your website for possible vulnerabilities and fix any issues.

## How to protect your website against hackers
Here are a few best practices to prevent hackers from hacking your website:

1. Change default credentials
2. Use strong passwords
3. Use 2-factor authentication
4. Always type your website login URL in the browser manually (or use a bookmark)
5. Never provide your personal information in response to an unsolicited request either over the phone or Internet.
6. Make sure you're using an updated version of the software you're using (turn on auto-update if available).
7. Remove old, test, and debug files from your website
8. Setup your website using recommended configurations for the production
9. Use a [web vulnerability scanner](https://www.thesmartscanner.com) to regularly scan your website for finding and fixing weaknesses.
10. Use a Web Application Firewall (WAF)