In this blog, I will demonstrate the laboratory I did during my postgraduate study. Acunetix is usefule for determining vulnerabilities of a website, adding priorities based on severity and assisting in remediation planning.

Procedures

Step 1: Download and Install the Acunetix Scanner. Acunetix provides its Web Vulnerability scanner as a 14-day limited-term trial download. You can download it at https://acunetix-web-vulnerability-scanner.software.informer.com/11.0/

After downloading, you need to access it via localhost. The default port was used, so I need to tweak some configuration and restart the service to make it work.

Step 2: Select an Application and Scan it. The target is http://vulnweb.com. After that, initiate the scan and you will notice that it is vulnerable to same site scripting

  1. The most critical vulnerability of the site is the Same Site Scripting. 

    Same-site scripting happens when an attacker executes a script in the same origin/domain. 

  • For example, when user misconfigured DNS to be 2.2.2.2(evil.grace.com) instead of 1.1.1.1(www.grace.com). The user accesses the malicious IP believing it connects to . 

  • If http was used to connect to that site, it cannot validate the certificate, hence allowing the user to connect to that IP(believing that it was www.grace.com). As browser detects that its , Same Origin Policy may not apply.

  • The attacker can then exploit the web server in that same origin. It will target the website with no input validation. For example is the search bar, if there is no input validation, the attacker can inject malicious command in <script>alert(‘XSS Attack’) </script>. 

  • Thus, when user access the server, that command will be reflected to the user.  This lead to stealing cookies, and other malicious activities

Hence, to remediate the vulnerability:

  • Always, practice secure coding. Have an input validation to make sure that no malicious content can be injected.

  • Add Content Security Policy. It restricts the sources to where the script can be executed

  • Use https to prevent interception/manipulation of data


Coding change is needed for it to be compliant

  • For web vulnerability, the most common is the cross-site scripting. It allows the attacker to add malicious code in the web even they are not in the same origin.

  • Recommendation would be almost the same as the same site scripting:

    • Have a proper input validation to prevent the attacker from injecting malicious scripts.

    • Sanitize the code, remove unused features, scripts and libraries.

    • Add output encoding. Use escape filter/DOMpurify to ensure that user inputs are properly encoded

    • In the code, add content security policy (CSP) to allow execution of scripts from trusted sources only.


Other ways to make it compliant:

If I will not be able to change the code, I will recommend:

  • Regular security audits and penetration testing.

  • Have a wiki page standard policies that must be documented for secure coding.

  • Regularly check certificate expiration as http protocol can lead to MITM attacks.

  • Provide Security Awareness regarding Cross Site Scripting.

  • Configure CORS Policies. By doing this, you restrict which origins are permitted to access their resources.