Core Safety Principles
Never Run in Production
Prohibited Environments
- Production servers
- Corporate networks
- Shared hosting platforms
- Cloud services with production data
- Systems with sensitive information
Approved Environments
- Isolated VMs or containers
- Dedicated testing hardware
- Secure architecture sandboxes
- Properly configured cloud development environments
- Air-gapped systems
Network Isolation
Ensure your sandbox environment is properly isolated from production networks:Verify Network Configuration
- Use NAT or Host-only networking in VMs
- Never use Bridged mode with vulnerable applications
- Configure Docker with
--internalnetworks when appropriate - Disable external network access if not needed for testing
Data Management
Never Use Real Data
Safe Test Data Guidelines
User Data
User Data
- Fictional names and addresses
- Test email addresses (e.g.,
[email protected]) - Synthetic phone numbers
- Dummy credit card numbers (test card numbers from payment processor docs)
- Real user credentials
- Actual email addresses
- Personal information from databases
- Production API keys or tokens
Database Content
Database Content
- Generated lorem ipsum text
- Faker libraries for realistic but fake data
- Small datasets (< 1000 records for most tests)
- Clear identifiers that data is for testing
- Copy production databases
- Use backups containing real data
- Import user-generated content from production
Credentials and Secrets
Credentials and Secrets
- Temporary test credentials
- Sandbox-only API keys
- Development-specific tokens
- Well-known test passwords (document them clearly)
- Reuse production credentials
- Test with your personal passwords
- Store real API keys in test code
- Commit secrets to version control
Data Cleanup
Document All Test Data
Security Testing Best Practices
Legal and Ethical Considerations
Testing Scope and Boundaries
Define Testing Scope
- What systems will be tested
- What testing methods will be used
- Time windows for testing
- Success criteria and stop conditions
Obtain Permission
- Get written or documented permission
- Share your testing plan
- Agree on communication protocols
- Establish incident response procedures
SAST Best Practices
Static Application Security Testing analyzes source code without execution.Code Review Checklist
- Privacy issues (unnecessary data storage)
- Authentication mechanisms
- Authorization controls
- Data validation
- Exception handling
- Session management
- Logging practices
- Encryption usage
Automated SAST Tools
- Bandit (Python)
- SonarQube
- GitHub Security Scanning
- Semgrep
Code Review Focus Areas
Code Review Focus Areas
- Is sensitive data stored unnecessarily?
- Are passwords encrypted before storage?
- Can users download and delete their data?
- Are users provided access to privacy policy?
- Is sensitive data logged to error files?
- Are users properly authenticated?
- What authentication factors are used?
- Are there password complexity policies?
- Are sessions properly managed?
- Is user-submitted data validated?
- When is validation performed?
- What validation methods are used (whitelist/blacklist)?
- Are SQL queries using parameterized statements?
- What error details are shown to users?
- Are errors logged with sufficient detail?
- Are database errors properly handled?
DAST Best Practices
Dynamic Application Security Testing examines running applications.Prepare Testing Environment
- Ensure sandbox is properly isolated
- Deploy application in testing mode
- Configure logging for detailed capture
- Prepare monitoring tools
Use Automated DAST Tools
- ZAPROXY - Open source pen testing application
- Burp Suite - Web security testing
- Nikto - Web server scanner
Test Common Vulnerabilities
- SQL injection
- Cross-site scripting (XSS)
- Cross-site request forgery (CSRF)
- Broken authentication
- Security misconfigurations
- Sensitive data exposure
Penetration Testing Best Practices
Penetration testing simulates real-world attacks to find and exploit vulnerabilities.Types of Penetration Testing
White-Box
Grey-Box
Black-Box
Brute Force Testing
XSS Testing Scripts
XSS Testing Scripts
- Form input fields
- URL parameters
- HTTP headers
- File upload names
- Search queries
SQL Injection Testing
SQL Injection Testing
- Login forms
- Search fields
- URL parameters
- Any user input that queries a database
Credential Testing
Credential Testing
- password, 123456, admin
- Default credentials
- Password variations
- Implement rate limiting in testing
- Don’t overwhelm the system
- Document successful compromises
Useful Testing Tools
HTTP Request Testing
Data Analysis
DNS/Network Scanning
SSL/TLS Testing
API Testing
Network Analysis
Testing Workflow and Documentation
Systematic Testing Approach
Phase 1: Reconnaissance
- Map application structure
- Identify technologies used
- Document endpoints and functionality
- Review available source code (white-box)
Phase 2: Automated Scanning
- Run static code analysis tools
- Review tool reports
- Prioritize findings by severity
- Run automated vulnerability scanners
- Configure scanners for thorough coverage
- Review and triage findings
Phase 3: Manual Testing
- Examine authentication logic
- Review data validation
- Check error handling
- Assess session management
- Test for injection flaws
- Attempt XSS attacks
- Test CSRF protection
- Verify access controls
Phase 4: Documentation
- Vulnerability name and type
- Severity level (Critical/High/Medium/Low)
- Detailed description
- Affected components
- Steps to reproduce
- Proof of concept (screenshots, code)
- Impact assessment
- Recommended remediation
Phase 5: Remediation
- Develop patches using HTML/CSS/JS/SQL/JSON/Python
- Test patches in sandbox
- Verify vulnerability is resolved
- Document the fix
- Re-scan to ensure no new issues introduced
Report Structure Template
1. Executive Summary
1. Executive Summary
- Project overview
- Testing methodology
- High-level findings
- Critical vulnerabilities summary
- Overall security posture assessment
2. Technical Analysis Approach
2. Technical Analysis Approach
- Testing scope and boundaries
- Tools and techniques used
- Testing environments
- Timeline of activities
- Team members involved
3. Out-of-Scope Items
3. Out-of-Scope Items
- Organizational policies
- User behavior and training
- Physical security
- Third-party dependencies
- Performance under real load
- Integration with production services
- Actual SSL/TLS configurations
- Production network security
4. Vulnerability Findings
4. Vulnerability Findings
- ID: VUL-001
- Title: SQL Injection in Login Form
- Severity: Critical
- Description: The login form does not properly sanitize user input…
- Location:
/loginendpoint, username parameter - Steps to Reproduce:
- Navigate to login page
- Enter
admin' OR '1'='1in username - Enter any password
- Click submit
- Impact: Attacker can bypass authentication and gain admin access
- Evidence: [Screenshot or code snippet]
- Recommendation: Use parameterized queries
5. Security by Design Recommendations
5. Security by Design Recommendations
- Authentication and authorization improvements
- Input validation strategies
- Security headers implementation
- Encryption requirements
- Logging and monitoring
- Secure development practices
- Security testing in SDLC
- Incident response procedures
6. Implemented Fixes
6. Implemented Fixes
- Vulnerability ID: VUL-001
- Fix Description: Implemented parameterized queries
- Code Changes:
- Files Modified:
app.py, line 45-50 - Testing: Verified SQL injection no longer possible
- Status: Resolved
Environment Maintenance
Regular Updates
Snapshot Management
- Clean Install: Fresh OS with dependencies installed
- Application Deployed: App running with test data
- Pre-Test: Before beginning security assessment
- Post-Patch: After implementing security fixes
Resource Monitoring
Emergency Procedures
If Sandbox is Compromised
Isolate Immediately
- Disconnect network access
- Pause or stop the VM/container
- Do not access any other systems
Document the Incident
- Note what you were testing
- Record any unusual behavior
- Save logs if accessible
- Take screenshots
Restore from Snapshot
- Restore to last known good state
- If no snapshots, rebuild from scratch
- Do not attempt to “fix” a compromised sandbox
If Host System is Affected
- Disconnect from network immediately
- Contact your instructor or IT security team
- Do not attempt to investigate alone
- Follow institutional incident response procedures
- Report as required by Australian Government guidelines: Responding to cyber security incidents
