Web Application Security Quiz (Short Version)

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Searchlab
S
Searchlab
Community Contributor
Quizzes Created: 4 | Total Attempts: 4,714
Questions: 5 | Attempts: 1,491

SettingsSettingsSettings
Web Application Security Quiz (Short Version) - Quiz


Questions and Answers
  • 1. 

    The most effective way of protecting against SQL injection is… 

    • A.

      … blacklisting strings such as "1 OR 1=1" and "UNION" from input.

    • B.

      … using an intrusion detection system to detect attacks.

    • C.

      … whitelisting input (e.g. only allowing alphanumerical characters and spaces).

    • D.

      … use of prepared statements or parametrized queries.

    • E.

      … segmenting database accounts and minimizing their user rights.

    Correct Answer
    D. … use of prepared statements or parametrized queries.
    Explanation
    a] Blacklisting is a poor solution against SQL injection. It can be avoided in multiple ways, and can block valid user input if overused.
    b] IDS can detect obvious SQL injection attempts, but it is possible for skilled attackers to avoid detection.
    c] Whitelisting can be effective in general, but it overly restricts valid input. Many names have dashes and apostrophes in them, for example.
    d] Use of prepared statements is generally accepted as the most effective way of protecting against SQL injection. The built-in escaping and validation will prohibit attackers from injecting a string into a numeric field, and quote data in string fields properly.
    e] Adhering to the principle of least privilege is generally a good thing, but it only reduces the impact of a successful attack.

    Rate this question:

  • 2. 

    Which is NOT true with respect to cross-site scripting (XSS) vulnerabilities?

    • A.

      The attacker may be able to run arbitrary code on the user's machine.

    • B.

      The attacker can exploit a XSS vulnerability in order to impersonate a user.

    • C.

      Reflected XSS vulnerabilities can only be triggered if the user performs a certain action.

    • D.

      The user cannot do anything to protect himself against reflected XSS on a page that he normally trusts.

    • E.

      An XSS payload may use AJAX requests to persistently infect multiple pages on the host.

    Correct Answer
    D. The user cannot do anything to protect himself against reflected XSS on a page that he normally trusts.
    Explanation
    a] True; if there is a vulnerability in the JavaScript interpreter or in one of the browser plugins, an XSS attack can lead to client-side code execution.
    b] True; an attacker can steal the user’s authentication data from cookies and use it to impersonate the user.
    c] True; by definition, a reflected XSS vulnerability is triggered by the user actively following a link.
    d] This is NOT true; there are browser plugins such as NoScript that can prevent running JavaScript from untrusted sites.
    e] True, the payload may contain a HTTP request that is parametrized to exploit an XSS in another page on the same host. See the Samy MySpace worm for an example.

    Rate this question:

  • 3. 

    If a web application includes a WYSIWYG editor, which of the approaches described below would NOT be appropriate for dealing with potential XSS in user input?

    • A.

      Looking for dangerous strings such as <script>, javascript: and eval(.*) in user-submitted data, and removing them.

    • B.

      Converting HTML control characters such as < to HTML entities such as &lt;.

    • C.

      Only allowing certain 'safe' tags for formatting, such as <b>, <i>, <p>, <br>.

    • D.

      Using special tags (such as [url=...]) and converting them to HTML

    • E.

      Using a HTML filter library to remove potential XSS code from output.

    Correct Answer(s)
    A. Looking for dangerous strings such as <script>, javascript: and eval(.*) in user-submitted data, and removing them.
    B. Converting HTML control characters such as < to HTML entities such as &lt;.
    Explanation
    a] Blacklisting is not a good approach, as there are many ways to circumvent and avoid such filters.
    b] While this prevents cross-site scripting attacks, it also prevents users from submitting any kind of active content to the site.
    c] This approach may be viable depending on the context, but it significantly restricts the scope of content users can submit – e.g. links.
    d] This approach is generally accepted as the best compromise. However, the parameters of the special tags (e.g. URLs) must be validated in some way before conversion.
    e] Depending on the language of the webapp, this may be a viable solution.

    Rate this question:

  • 4. 

    Which statement is true with respect to HTML5 security?

    • A.

      In HTML5, AJAX calls can read from other domains without restrictions.

    • B.

      Thanks to the new possibilities of HTML5, an attacker can steal data from an iframe through ClickJacking.

    • C.

      If a page does not use the new features introduced by HTML5, it is a good way to protect against the new security risks introduced by those features.

    • D.

      HTML5 makes it easier to protect against XSS.

    • E.

      Local Storage cannot be directly manipulated by XSS.

    Correct Answer
    B. Thanks to the new possibilities of HTML5, an attacker can steal data from an iframe through ClickJacking.
    Explanation
    A] False – the other domain needs to explicitly allow this
    B] True
    C] False – if the browser supports HTML5, the attacker can inject any kind of HTML5 tag into the page
    D] False – it actually gives the attackers more opportunities for XSS attacks
    E] False – Cross-site scripting attacks can read or modify Local Storage contents

    Rate this question:

  • 5. 

    If the attacker can run JavaScript on the user’s machine, he can expect to…

    • A.

      … modify other currently running scripts.

    • B.

      … simulate user clicks in the browser.

    • C.

      … run arbitrary native code on the user’s machine.

    • D.

      … modify user session data.

    • E.

      … act as a keylogger within the scope of the JavaScript’s origin.

    Correct Answer(s)
    A. … modify other currently running scripts.
    B. … simulate user clicks in the browser.
    E. … act as a keylogger within the scope of the JavaScript’s origin.
    Explanation
    a] True – the attacker can rewrite methods and change variables of other JavaScripts.
    b] True – JavaScript clicks are equivalent to user clicks.
    c] False – this is only possible if there is a bug in the browser that can be exploited through JavaScript.
    d] False – a typical client-side breach cannot affect assets stored on the server.
    e] True – JavaScript can relay keystrokes and e.g. send them to an iframe.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Aug 17, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Sep 19, 2012
    Quiz Created by
    Searchlab
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.