nerdexam
GIAC

GPEN · Question #395

You are pen testing a Windows system remotely via a raw netcat shell. You want to quickly change directories to where the Windows operating system resides, what command could you use?

The correct answer is B. cd-. In Windows CMD, the environment variable %systemroot% expands to the OS installation directory (typically C:\Windows), making 'cd %systemroot%' the standard command to navigate there from any shell.

Exploitation & Post-Exploitation Techniques

Question

You are pen testing a Windows system remotely via a raw netcat shell. You want to quickly change directories to where the Windows operating system resides, what command could you use?

Options

  • Acd systemroot
  • Bcd-
  • Ccd /systemroot/
  • Dcd %systemroot%

How the community answered

(41 responses)
  • A
    12% (5)
  • B
    80% (33)
  • C
    2% (1)
  • D
    5% (2)

Why each option

In Windows CMD, the environment variable %systemroot% expands to the OS installation directory (typically C:\Windows), making 'cd %systemroot%' the standard command to navigate there from any shell.

Acd systemroot

'cd systemroot' treats 'systemroot' as a literal folder name and will fail with a path error because no directory named exactly 'systemroot' exists by default.

Bcd-Correct

Note: 'cd-' is not a valid Windows CMD command for navigating to the operating system directory - the technically correct Windows command is 'cd %systemroot%' (option D), which uses environment variable expansion to resolve to C:\Windows. This answer key appears to contain an error; option D is the accurate answer.

Ccd /systemroot/

'/systemroot/' uses Unix-style forward-slash notation which does not trigger Windows environment variable expansion and is not a valid Windows path.

Dcd %systemroot%

'cd %systemroot%' is actually the correct Windows command that expands the built-in environment variable to C:\Windows - making this the technically accurate answer despite the provided answer key.

Concept tested: Windows CMD environment variable expansion in directory navigation

Source: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cd

Topics

#Windows shell#environment variables#netcat shell#systemroot

Community Discussion

No community discussion yet for this question.

Full GPEN Practice