← Back to quizzesFree quiz

Web and Mobile Security Practices

In today’s interconnected world, protecting data at rest and in transit is a fundamental requirement for both web applications and mobile devices. This course explores the most common…

21 questions~11 min
Web and Mobile Security Practices — Qwi
0 / 21
Score: 0%
1

Which mitigation technique directly prevents SQL Injection attacks in web applications?

2

A mobile device is lost and an attacker gains physical access. Which of the following controls most effectively protects the stored data?

3

In a corporate BYOD policy, which characteristic distinguishes it from COPE?

4

During a penetration test, the tester has full access to source code and network diagrams. Which testing level does this scenario represent?

5

Which of the following is a primary defense against Cross‑Site Request Forgery (CSRF) attacks?

6

A developer integrates a third‑party library that has a known vulnerability. Which security practice would most directly mitigate the risk introduced by this component?

7

Which of the following mobile threats specifically exploits the trust relationship of public Wi‑Fi networks?

8

During a DAST scan of a web API, which security property is primarily evaluated?

9

Which EMM feature most directly enables remote wiping of corporate data on a lost mobile device?

10

A tester discovers that an application improperly concatenates user input into an SQL statement. Which remediation step should be prioritized?

11

Which of the following best describes the principle of least privilege in the context of mobile device security?

12

In the pentesting lifecycle, which phase directly follows vulnerability analysis?

13

Which security control specifically addresses the risk of malicious apps requesting excessive permissions on Android devices?

14

A company wants to ensure that any data exfiltrated from its web servers is detected. Which technology mentioned in the text directly supports this goal?

15

Which testing approach combines both static and dynamic analysis within a CI/CD pipeline?

16

Which of the following attacks exploits the trust relationship between a user’s browser and a legitimate site to perform unauthorized actions?

17

During a social engineering simulation targeting mobile users, which scenario best tests awareness of phishing via SMS?

18

Which of the following statements best reflects the purpose of a Content Security Policy (CSP) in web security?

19

An organization adopts a BYOD model but wants to limit corporate data exposure. Which additional control should be applied?

20

Which phase of the pentesting methodology is primarily concerned with documenting findings and recommending mitigations?

21

Which of the following is a common trap when configuring anti‑CSRF tokens?

Introduction to Web and Mobile Security Practices

In today’s interconnected world, protecting data at rest and in transit is a fundamental requirement for both web applications and mobile devices. This course explores the most common threats—SQL injection, CSRF, man‑in‑the‑middle attacks, and more—and presents proven mitigation techniques. By the end of the module, you will understand how to apply secure coding practices, device‑level controls, and organizational policies such as BYOD and COPE.

1. Secure Coding Techniques for Web Applications

1.1 Preventing SQL Injection

SQL injection remains one of the top‑ranked OWASP Top 10 vulnerabilities. The most effective mitigation is the use of prepared statements with parameterized queries. By separating SQL logic from user‑supplied data, the database engine treats inputs as literals rather than executable code.

  • Why other options fall short:
    • Strong password policies improve authentication but do not affect query parsing.
    • Escaping HTML characters mitigates XSS, not SQL injection.
    • Content Security Policy (CSP) headers protect against client‑side script injection, not database attacks.

Implementing prepared statements is language‑specific but follows the same principle across PHP (PDO), Java (JDBC), .NET (SqlCommand), and Python (psycopg2).

1.2 Defending Against Cross‑Site Request Forgery (CSRF)

CSRF tricks a logged‑in user’s browser into performing unwanted actions on a trusted site. The primary defense is the inclusion of anti‑CSRF tokens in state‑changing requests. These tokens are unique per session and validated server‑side before processing the request.

  • Additional layers such as SameSite cookies and strict Referer checking further reduce risk, but the token remains the cornerstone.

1.3 Secure Use of Third‑Party Components

Modern development relies heavily on open‑source libraries. A known vulnerability in any component can compromise the entire application. The most direct mitigation is to maintain an inventory of third‑party components and patch them promptly. Tools such as Software Composition Analysis (SCA) automate this process, alerting developers when a new CVE is published.

  • While static analysis (SAST) can detect insecure code, it does not replace the need for timely updates.
  • Encrypting data before passing it to a vulnerable library does not address the root cause.
  • CSP can limit the execution of malicious scripts but cannot stop a compromised library from executing legitimate code.

2. Mobile Device Security Controls

2.1 Protecting Data at Rest

When a mobile device is lost or stolen, the most effective safeguard is encryption of data at rest. Modern operating systems (iOS, Android) provide full‑disk encryption that ties decryption keys to the user’s authentication method (PIN, biometrics). This ensures that even if an attacker gains physical access, the stored data remains unreadable.

  • Requiring a strong PIN adds a layer of defense but does not protect data if the device is powered off and the encryption key is stored in hardware.
  • Mobile antivirus and disabling Wi‑Fi address network‑based threats, not data‑at‑rest confidentiality.

2.2 Understanding BYOD vs. COPE

Organizations often allow employees to use personal devices for work (BYOD) or provide corporate‑owned devices that employees can personalize (COPE). The key distinction is that BYOD devices are personally owned and may contain personal data, whereas COPE devices are owned by the company.

  • This difference influences policy decisions, such as the level of monitoring, remote‑wipe capabilities, and privacy expectations.

2.3 Mobile Threats on Public Wi‑Fi

Public Wi‑Fi networks are fertile ground for Man‑in‑the‑Middle (MitM) attacks. Attackers intercept traffic between the device and the internet, potentially stealing credentials or injecting malicious payloads. Countermeasures include:

  • Using VPN tunnels for all traffic.
  • Enforcing HTTPS with HSTS.
  • Avoiding sensitive transactions on unsecured networks.

3. Security Testing Methodologies

3.1 White‑Box vs. Black‑Box vs. Gray‑Box Testing

Penetration testing can be categorized by the amount of information provided to the tester. When the tester has full access to source code and network diagrams, the test is known as white‑box testing. This approach enables deep analysis of logic flaws, insecure configurations, and hidden vulnerabilities.

  • Black‑box testing offers no internal knowledge, simulating an external attacker.
  • Gray‑box testing provides limited insight, often representing an insider threat.
  • Red‑team exercises focus on realistic, multi‑vector attacks rather than specific code reviews.

3.2 Dynamic Application Security Testing (DAST)

During a DAST scan of a web API, the primary focus is on the runtime behavior such as authentication, input handling, and response validation. Unlike static analysis, DAST interacts with the running application, exposing vulnerabilities that only appear during execution (e.g., broken authentication, insecure direct object references).

  • DAST does not evaluate source code quality, static configuration files, or network topology directly.

4. Best Practices Checklist

  • Use parameterized queries for every database interaction.
  • Implement anti‑CSRF tokens on all state‑changing endpoints.
  • Encrypt mobile data at rest and enforce strong device authentication.
  • Maintain an up‑to‑date inventory of third‑party libraries and apply patches promptly.
  • Choose the appropriate testing level (white‑box, gray‑box, black‑box) based on risk assessment.
  • Run DAST scans regularly to validate runtime security controls.
  • Educate users about the dangers of public Wi‑Fi and promote VPN usage.
  • Define clear BYOD and COPE policies that balance security with privacy.

5. Frequently Asked Questions (FAQ)

What is the difference between CSP and input sanitization?

Content Security Policy (CSP) is a browser‑enforced header that restricts where scripts, styles, and other resources can be loaded from. Input sanitization, on the other hand, cleans user‑provided data before it is processed or stored. CSP mitigates client‑side script injection, while sanitization prevents server‑side attacks such as XSS and SQL injection.

Can a strong PIN replace device encryption?

No. A PIN protects against unauthorized access while the device is unlocked, but encryption protects the data even when the device is powered off or the storage is physically removed. Both should be used together for layered security.

When should I use gray‑box testing?

Gray‑box testing is ideal when you want to simulate an insider threat or a scenario where an attacker has limited knowledge (e.g., a compromised employee account). It balances realism with the efficiency of having some internal insight.

Conclusion

Effective web and mobile security requires a combination of secure development practices, robust device controls, and comprehensive testing strategies. By integrating prepared statements, anti‑CSRF tokens, data‑at‑rest encryption, and regular white‑box testing, organizations can significantly reduce their attack surface. Remember that security is a continuous process—stay informed about emerging threats, keep your component inventory current, and educate users on safe mobile habits.