nerdexam
CompTIA

PT0-001 · Question #70

Which of the following commands will allow a tester to enumerate potential unquoted services paths on a host?

The correct answer is D. wmic service get name, displayname, patchname, startmode | findstr /i "auto" | findstr /i /v. Identifying unquoted service paths requires a WMIC query that retrieves service executable pathnames and filters results to highlight auto-start services whose paths may contain exploitable unquoted spaces.

Vulnerability discovery and analysis

Question

Which of the following commands will allow a tester to enumerate potential unquoted services paths on a host?

Options

  • Awmic environment get name, variablevalue, username / findstr /i "Path" | findstr /i "service"
  • Bwmic service get /format:hform > c:\temp\services.html
  • Cwmic startup get caption, location, command | findstr /i "service" | findstr /v /i "%"
  • Dwmic service get name, displayname, patchname, startmode | findstr /i "auto" | findstr /i /v

How the community answered

(32 responses)
  • A
    13% (4)
  • B
    6% (2)
  • C
    3% (1)
  • D
    78% (25)

Why each option

Identifying unquoted service paths requires a WMIC query that retrieves service executable pathnames and filters results to highlight auto-start services whose paths may contain exploitable unquoted spaces.

Awmic environment get name, variablevalue, username / findstr /i "Path" | findstr /i "service"

This command queries the 'wmic environment' class, which exposes system environment variables, not service executable paths, so it cannot surface unquoted path vulnerabilities.

Bwmic service get /format:hform > c:\temp\services.html

This command exports all service data to an HTML report file and performs no filtering or path-quoting analysis, making it unsuitable for targeted unquoted path enumeration.

Cwmic startup get caption, location, command | findstr /i "service" | findstr /v /i "%"

This command queries 'wmic startup' entries, which are run-once or login startup items, not installed Windows services, and therefore cannot enumerate service path vulnerabilities.

Dwmic service get name, displayname, patchname, startmode | findstr /i "auto" | findstr /i /vCorrect

The command queries service name, displayname, pathname, and startmode via WMIC, which exposes the full executable path for each service. Piping through 'findstr /i auto' isolates automatically starting services, and the additional findstr /v filter removes entries with properly quoted paths, leaving candidates for unquoted path privilege escalation. Pathname is the critical field that reveals whether spaces in the path are unquoted.

Concept tested: WMIC enumeration of unquoted service paths

Source: https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmic

Topics

#unquoted service path#wmic#Windows enumeration#privilege escalation

Community Discussion

No community discussion yet for this question.

Full PT0-001 Practice