How to do a good test? (6) Security Testing (ST)

1. Introduction to security testing:

Security Testing (ST) is the process of evaluating and verifying the security of the system. It aims to discover potential security vulnerabilities, weaknesses and risks in the system and provide corresponding recommendations and solutions to protect the system from potential security threats. Security testing typically includes testing of: authentication and authorization, data protection and encryption, session management, input validation, security configuration, error handling and exception management, security logging, etc.

2. Usage scenarios:

Security testing is applicable to any system that involves sensitive information (such as personal identity, payment information, etc.) or needs to protect user data, especially for applications such as online shopping systems. In online shopping systems, security testing can ensure that users' personal and payment information are properly protected, preventing malicious attackers from obtaining sensitive data or exploiting system vulnerabilities to conduct illegal activities.

3. Common technologies and tools:

  • Vulnerability scanning tools: used to scan known vulnerabilities and weaknesses in the system, such as Nessus, OpenVAS, etc.
  • Penetration testing tools: simulate real attack scenarios and evaluate the system’s defense capabilities, such as Metasploit, Burp Suite, etc.
  • Web Application Firewall (WAF): Used to detect and block potentially malicious behaviors and attacks, such as ModSecurity, etc.
  • Code review tools: used to statically analyze application code and find potential security vulnerabilities, such as SonarQube, Checkmarx, etc.

4. Specific implementation methods:

  1. Security requirements analysis : Analyze the security requirements of the system and formulate the goals and scope of security testing.
  2. Vulnerability scanning : Use vulnerability scanning tools to scan the system and discover known vulnerabilities and weaknesses.
  3. Penetration testing : simulate real attack scenarios, try to bypass the system's security measures, and evaluate the system's defense capabilities.
  4. Authentication and authorization testing : Test whether the system’s authentication and authorization mechanisms are safe and reliable.
  5. Data protection and encryption testing : Verify whether the system's protection and encryption mechanisms for sensitive data are effective.
  6. Input validation testing : Test whether the system's verification and filtering of user input are sufficient to prevent injection attacks.
  7. Session management test : Test whether the system's session management mechanism is secure and prevent session hijacking and session fixation attacks.
  8. Security configuration testing : Check whether the system's security configuration complies with best practices and avoids common security vulnerabilities.
  9. Error handling and exception management testing : Test whether the system's handling of errors and exceptions is safe and reliable.
  10. Security logging test : Verify whether the system's security logging mechanism is effective and can track and analyze security events.

5. Test cases designed for main security test indicators:

5.1. Test case name : Cross-site scripting attack (XSS) protection

Test goal : Verify whether the system can correctly filter and escape user input to prevent XSS attacks.
Test prerequisite : The user is logged in and has access to the page containing the input fields.
Test steps :

  1. Enter content containing malicious scripts in the input box.
  2. Submit the form or save your entries.

Expected results : The system should properly filter and escape input, preventing the execution of malicious scripts.
Actual results : The system successfully filters and escapes input, preventing the execution of malicious scripts.
Conclusion : The system passed the XSS injection protection test.
Note : None

5.2. Test case name : SQL injection protection

Test goal : Verify whether the system can correctly filter and escape user input to prevent SQL injection attacks.
Test prerequisite : The user is logged in and has access to the page containing the input fields.
Test steps :

  1. Enter the content containing the SQL injection statement in the input box.
  2. Submit the form or save your entries.

Expected results : The system should properly filter and escape input, preventing SQL injection attacks.
Actual results : The system successfully filters and escapes input, preventing SQL injection attacks.
Conclusion : The system passed the SQL injection protection test.
Note : None

5.3. Test case name : Session management security

Test goal : Verify whether the system can correctly handle session fixation attacks.
Test prerequisite : The user has logged in and obtained a valid session ID.
Test steps :

  1. Manually change the session ID in the same browser.
  2. Trying to access a protected page.

Expected results : The system should detect the change in session ID and deny access or require re-authentication.
Actual result : The system successfully detected the change in session ID and rejected illegal access.
Conclusion : The system passed the session fixation attack test.
Note : None

5.4. Test case name : Access control verification

Test goal : Verify that the system correctly restricts access to restricted resources.
Test prerequisites : The user is logged in and has access rights to restricted resources.
Test steps :

  1. Attempt to access restricted resources using an unauthorized user account.

Expected results : The system should deny access to unauthorized users and return an appropriate error message.
Actual result : The system successfully denies access to the unauthorized user and returns an appropriate error message.
Conclusion : The system passed the unauthorized access test.
Note : None

5.5. Test case name: Sensitive data protection

Test goal : Verify that the system correctly encrypts and protects sensitive data.
Test prerequisite : Sensitive data (such as passwords, payment information) is stored in the system.
Test steps :

  1. Check that sensitive data stored in the database is properly encrypted.

Expected results : Sensitive data should be encrypted in a secure manner and the original content cannot be viewed directly.
Actual result : Sensitive data has been encrypted in a secure manner and the original content cannot be viewed directly.
Conclusion : The system passed the sensitive data encryption test.
Note : None

5.6. Test case name: Weak password policy

Test goal : Verify that the system can correctly enforce users to use strong passwords.
Test prerequisite : Users can create new accounts and set passwords.
Test steps :

  1. Use weak passwords (e.g. common passwords, simple passwords) when creating user accounts.

Expected results : The system should require users to use strong passwords and provide appropriate password complexity requirements.
Actual results : The system successfully requires users to use strong passwords and provides password complexity requirements.
Conclusion : The system passed the weak password verification test.
Note: None

5.7. Test case name: Security logging

Test goal : Verify that the system correctly records key events and security-related operations.
Test prerequisite : The system has been configured to record security logs.
Test steps :

  1. In scenarios such as login, logout, and important operations, check whether the system records security logs correctly.

Expected results : The system should properly log critical events and security-related actions with sufficient log details.
Actual results : The system successfully logged critical events and security-related actions with sufficient log detail.
Conclusion : The system passed the security logging test.
Note : None

5.8. Test case name: Security configuration verification

Test goal : Verify whether the system takes appropriate security configuration measures.
Test prerequisites : The system has been installed and configured with default settings.
Test steps :

  1. Check whether the system uses the default administrator account and password.
  2. Check whether the system has closed or restricted unnecessary services and ports.

Expected results : The system should require administrators to modify initial credentials and take appropriate security configuration measures.
Actual result : The system successfully required the administrator to modify the initial credentials and took appropriate security configuration measures.
Conclusion : The system passed the default configuration security test.
Note : None

5.9. Test case name: File upload verification

Test goal : Verify that the system correctly validates and processes uploaded files.
Test prerequisite : The user is logged in and can upload files.
Test steps :

  1. Attempt to upload a file that contains malicious code or executable files.

Expected results : The system should correctly validate file type and content and reject malicious file uploads.
Actual result : The system successfully verified the file type and content and rejected the malicious file upload.
Conclusion : The system passed the malicious file upload test.
Note : None

5.10. Test case name: Error handling and exception management

Test goal : Verify the system's ability to handle and manage error conditions and exceptions.
Test prerequisites : The system has been deployed and running.
Test steps :
1. Intentionally provide invalid or illegal data when submitting a form or request.
2. Check whether the error message returned by the system discloses sensitive information.
Expected results : The system should return a generic error message and should not disclose sensitive information to prevent information disclosure attacks.
Actual result : The system successfully returned a generic error message without disclosing sensitive information.
Conclusion : The system passed the error message disclosure test.
Note : None

These test cases cover different security testing objectives and are verified and evaluated with expected and actual results to draw conclusions. These test cases can be further expanded and customized according to actual conditions and needs to ensure that the system has strong security performance.

Guess you like

Origin blog.csdn.net/holyvslin/article/details/133420385