If you like DNray Forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...

 

SQL Injection on asp - Check site for vulnerability

Started by amitkedia, Jul 20, 2022, 01:05 AM

Previous topic - Next topic

amitkediaTopic starter

Hello,

I am a web specialist working for a company that recently tasked me with checking our website for potential threats from intruders. While the website's content is rarely updated and has no significant value, management still wants it to be secured. Though, I recognize that it would be best to hire professionals for this job.

The task at hand is to check for vulnerabilities, such as SQL injections. However, since the website is written in ASP, I struggled to find relevant articles that address this issue.

Therefore, I turned to this forum seeking advice. Our website utilizes Windows Server, IIS 7.0, MySQL database, Myphpadmin, and pages written in asp.net. If anyone has any useful insights or directions on how to proceed, please let me know.

Thank you.
  •  


Hitesh Patel

If an injection successfully penetrates the server, it becomes possible to identify the type of server. One can run the approximate MySQL server query "SHOW VARIABLES" to determine information such as the version number. However, if no vulnerability is found, it remains unclear which database server engine is in use.

To perform SQL injection, one must select queries containing universal SQL keywords. It is crucial to observe the server's response to identify the database server engine.
  •  

miaedwards

The primary method of SQL injection involves inputting parameter values directly into the request body. For example, a classic injection like "1=1" can be executed via the HTTP client by entering the value "(' OR 1=1 --)" which is then processed by the server.

However, SQL Server addresses this issue by parameterizing queries. Instead of passing the parameter value in the request text, only the parameter name is passed. The values themselves are passed separately and never fit into the request text.

SQL Server creates an execution plan based on the exact text of the query, and the parameter value is used as a search string rather than a Boolean expression. PDO behaves similarly, with escaping only used in emulated mode.

EF also uses parameterized queries internally, making it difficult to perform SQL injection. However, it's still possible to encounter issues if you use self-written SQL procedures that glue dynamic SQL from parameter values since EF is not involved in this process.
  •  

AaronJacobson

Securing a website is indeed an important task, even if the content is not frequently updated or valuable. While it's always advisable to consult with professionals for comprehensive security assessments, I can provide you with some general insights and directions to help you get started.

Here are a few steps you can take to check for potential vulnerabilities in your ASP-based website:

1. Regular Updates: Ensure that your Windows Server, IIS, MySQL, and related software are up to date. Regularly applying patches and updates can help address known vulnerabilities.

2. Secure Configuration: Review the configuration settings for your web server and database to ensure they are properly secured. This includes strong passwords, disabling unnecessary services, and implementing appropriate access controls.

3. Input Validation: One of the most common vulnerabilities is SQL injection. To mitigate this risk, carefully validate and sanitize all user inputs on your website. Use parameterized queries or prepared statements when interacting with the database to prevent malicious SQL code from being executed.

4. Error Handling: Implement proper error handling mechanisms to prevent sensitive information from being exposed to potential attackers. Avoid displaying detailed error messages that could reveal system information.

5. Security Headers: Utilize security headers in your web server configuration to add an extra layer of protection. Examples include Content Security Policy (CSP), HTTP Strict Transport Security (HSTS), and X-Frame-Options.

6. Firewall and Intrusion Detection: Implement a firewall and configure it to filter out unnecessary traffic. Additionally, set up an intrusion detection system (IDS) to monitor and alert you of any suspicious activities on the server.

7. Regular Monitoring and Logging: Enable logging features for both your web server and database. Regularly review logs to identify any potential security issues or abnormal activities.

few additional steps you can take to further enhance the security of your ASP-based website:

1. Secure Authentication: Ensure that user authentication is implemented properly. Use strong passwords and consider implementing multi-factor authentication (MFA) for added security. Protect against brute force attacks by enforcing account lockouts after multiple failed login attempts.

2. Secure Session Management: Implement secure session management practices, including using unique session IDs, setting session timeouts, and securely transmitting session data over HTTPS.

3. Secure File Uploads: Implement proper validation and handling of file uploads to prevent malicious files from being uploaded to your server. Validate file types, scan uploaded files for malware, and store them in a secure location outside of the web root directory.

4. Secure Error Messages: Be cautious about the information revealed in error messages. Ensure that only essential information is displayed to users while keeping sensitive details hidden. This will help prevent attackers from gaining insights into your system's configuration.

5. Access Control: Implement proper access controls to restrict user privileges and ensure that only authorized individuals can access sensitive areas of your website and database. Regularly review and update user roles and permissions as needed.

6. Web Application Firewall (WAF): Consider implementing a web application firewall to help protect against common attacks, such as cross-site scripting (XSS), cross-site request forgery (CSRF), and other web application vulnerabilities.

7. Security Testing and Code Review: Conduct regular security testing and code reviews to identify vulnerabilities and weaknesses in your website's code. Static code analysis tools and manual code review techniques can help identify potential issues.

8. Regular Backup and Disaster Recovery: Implement regular backups of your website, database, and server configuration. Store backups securely, preferably offsite, and regularly test the restoration process to ensure data recoverability in case of a security incident.

steps you can take to further enhance the security of your ASP-based website:

1. Secure Communication: Ensure that all communication between the website and users is encrypted using HTTPS. Obtain an SSL/TLS certificate and configure your web server to use secure protocols and strong cipher suites.

2. Database Security: Review the security of your MySQL database. Restrict database access to only necessary users and roles, enforce strong passwords, and employ encryption for sensitive data. Regularly backup your database and store backups securely.

3. User Input Validation: Validate and sanitize user input on both the client and server sides. This helps prevent different types of attacks, such as cross-site scripting (XSS) and cross-site request forgery (CSRF).

4. Least Privilege Principle: Follow the principle of least privilege by granting users or processes only the permissions necessary to perform their tasks. Avoid running your website with elevated privileges or using the default system account.

5. Secure File and Directory Permissions: Ensure that file and directory permissions are properly configured and restrict access to sensitive files and directories. Regularly review and update permissions as needed.

6. Security Headers: Implement additional security headers in your web server configuration, such as X-XSS-Protection and X-Content-Type-Options, to provide additional protection against known vulnerabilities and attacks.

7. Code Quality and Vulnerability Scanning: Conduct regular code reviews to identify any security flaws or vulnerabilities in your ASP.NET codebase. Utilize automated vulnerability scanning tools to assist in identifying common security issues.

8. Employee Awareness and Training: Educate your staff about best practices for web security, such as password hygiene, phishing awareness, and safe browsing habits. Ensure that employees understand their role in maintaining a secure website.

9. Incident Response Plan: Develop an incident response plan that outlines the steps to be taken in the event of a security breach or incident. This plan should include procedures for containment, investigation, and recovery.

10. Stay Informed: Keep up with the latest security news, updates, and best practices for ASP.NET and related technologies. Subscribe to security mailing lists, follow reputable security blogs, and participate in relevant forums and communities.
  •  


If you like DNray forum, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...