sajagkarki / MorePractice

0 stars 0 forks source link

LiveView Technologies(LVT) interview preparation #25

Open sajagkarki opened 3 months ago

sajagkarki commented 3 months ago

1.How would you approach securing a web application from SQL injection attacks? Here are the key steps to prevent SQL injection attacks:

Input validation:

Sanitize user input: Remove or escape special characters that could be used to inject malicious code. Use whitelists: Only allow specific characters or patterns in input. Avoid direct concatenation: Do not concatenate user input directly into SQL queries. Prepared statements:

Use parameterized queries: Separate data from SQL code, preventing injection attacks. Bind parameters: Bind user-provided values to placeholders in the SQL query. Least privilege principle:

Grant minimal permissions: Grant database users only the necessary permissions to perform their tasks. Avoid granting unnecessary privileges: Limit the scope of privileges to reduce the potential damage of a compromise. Error handling:

Handle errors gracefully: Avoid revealing sensitive information in error messages. Log errors: Log errors to track potential attacks and identify vulnerabilities. Regular testing and auditing:

Conduct security testing: Perform vulnerability assessments and penetration testing to identify potential vulnerabilities. Regular auditing: Audit database access logs and application code for signs of suspicious activity. 2.What are the key components of a secure software development lifecycle (SDLC)? A secure SDLC is a systematic approach to building software that incorporates security measures throughout the development process. Here are the key components:

Security requirements gathering: Identify security requirements and incorporate them into the project plan. Threat modeling: Analyze potential threats and vulnerabilities to the application. Secure design: Design the application with security in mind, following secure coding practices. Secure implementation: Implement security controls and best practices during development. Testing and validation: Conduct security testing to identify and address vulnerabilities. Deployment and operations: Deploy the application securely and monitor for vulnerabilities. Ongoing maintenance and updates: Continuously update and patch the application to address new vulnerabilities. 3.Describe the difference between a firewall and an intrusion detection system. Firewall: A network security device that filters incoming and outgoing network traffic based on predefined rules. It acts as a barrier to prevent unauthorized access. Intrusion detection system (IDS): A system that monitors network traffic for suspicious activity and raises alerts when potential attacks are detected. It is passive and does not prevent attacks directly. 4.What are the risks associated with using weak passwords? Weak passwords can lead to:

Unauthorized access: If a weak password is compromised, attackers can gain access to accounts and systems. Data breaches: Sensitive data can be exposed if accounts with weak passwords are compromised. Identity theft: Weak passwords can lead to identity theft if personal information is compromised. 5.How can you protect sensitive data in transit? To protect sensitive data in transit, you can use:

Encryption: Encrypt data using strong encryption algorithms to make it unreadable to unauthorized parties. HTTPS: Use HTTPS to encrypt data transmitted over the internet. VPN: Use a VPN to create a secure encrypted tunnel for data transmission. TLS/SSL: Use TLS/SSL certificates to authenticate servers and encrypt data. Data minimization: Only transmit the necessary data to reduce the risk of exposure.ata to reduce the risk of exposure.