nerdexam
CompTIA

CAS-003 · Question #854

A security analyst is examining threats with the following code function: Which of the following threats should the security analyst report?

The correct answer is E. There is unsafe execution of third-party JavaScript code. The code function contains unsafe execution of third-party JavaScript, which exposes the application to injection and cross-site scripting attacks.

Technical Integration of Enterprise Security

Question

A security analyst is examining threats with the following code function:

Which of the following threats should the security analyst report?

Exhibit

CAS-003 question #854 exhibit

Options

  • APOST should be used instead of GET when making requests.
  • BRoot privileges are needed for the service to bind to the privileged port 8443.
  • CThe website allows unauthorized access to sensitive resources.
  • DThe web server allows insecure cookie storage.
  • EThere is unsafe execution of third-party JavaScript code.

How the community answered

(35 responses)
  • A
    3% (1)
  • B
    6% (2)
  • C
    11% (4)
  • D
    3% (1)
  • E
    77% (27)

Why each option

The code function contains unsafe execution of third-party JavaScript, which exposes the application to injection and cross-site scripting attacks.

APOST should be used instead of GET when making requests.

Using GET for operations that modify server state is a design concern, but it does not represent a direct code-level execution vulnerability of comparable severity to unsafe script execution.

BRoot privileges are needed for the service to bind to the privileged port 8443.

Port 8443 is not a privileged port - privileged ports are those numbered below 1024 - so binding to port 8443 does not require root privileges and is not a security threat.

CThe website allows unauthorized access to sensitive resources.

Unauthorized access to sensitive resources reflects an access-control misconfiguration and would not be directly identifiable from a code function signature without additional context.

DThe web server allows insecure cookie storage.

Insecure cookie storage, such as missing HttpOnly or Secure flags, is a separate configuration-level concern that is distinct from code that unsafely executes external scripts.

EThere is unsafe execution of third-party JavaScript code.Correct

Unsafe execution of third-party JavaScript - through mechanisms such as eval(), document.write(), or dynamic script loading from untrusted sources - allows an attacker to inject and run arbitrary code within the application's security context. This can result in session hijacking, credential theft, or full application compromise, and is classified under OWASP's injection and XSS vulnerability categories. Executing unvalidated external JavaScript is one of the most critical code-level security risks in web and hybrid mobile applications.

Concept tested: Unsafe third-party JavaScript execution and XSS risk

Source: https://owasp.org/www-community/attacks/xss/

Topics

#JavaScript security#third-party code#client-side attacks#code analysis

Community Discussion

No community discussion yet for this question.

Full CAS-003 Practice