Professor Franklin
Accessibility settings

Preferences are saved in this browser when storage is available.

Getting Started

Chapter 8 · Reading 2 of 3

Logons, Remote Desktop and PowerShell

CHFI domains 3, 4 · GCFE: Windows event, service and application logs

The forwarded Security events from the credit union’s SIEM fill the gap before the log was cleared, and the local log covers what came after. Somewhere in them is the session that changed a member’s loan record. The examiner needs to tell how the account signed in, what it ran and what it changed on the way out.

Logon events and logon types

A successful logon writes 4624 on the computer where the session is created. A failed logon writes 4625, with a status code that gives the reason, such as a bad password or a disabled account. 4634 records a logoff and 4647 a user-initiated logoff. 4672 follows a logon that receives administrative privileges, and 4648 records a logon with explicitly supplied credentials, as with runas. On a domain controller, Kerberos events 4768 (ticket-granting ticket requested) and 4769 (service ticket requested) and the NTLM event 4776 record authentication for the whole domain.

Each 4624 carries a logon type and a Logon ID. The Logon ID appears in later events from the same session, so it is the thread that ties activity to a logon.

Figure 1. Logon types an examiner should know
TypeNameTypical cause
2InteractiveSigning in at the keyboard
3NetworkAccessing a file share; the first step of Remote Desktop with Network Level Authentication
4BatchScheduled task running as a user
5ServiceA service starting under an account
7UnlockUnlocking a locked workstation
8NetworkCleartextCredentials sent in clear text, such as basic authentication to IIS
9NewCredentialsrunas /netonly
10RemoteInteractiveRemote Desktop
11CachedInteractiveDomain sign-in using cached credentials while offline

Remote Desktop leaves a trail in several logs

On ACU-LOAN01, account ACU\lsato, a loan officer, has a 4624 of type 3 and then type 10 from 10.50.8.14, an address in the VPN pool, at 21:58:02 server time. That pair is typical of Remote Desktop with Network Level Authentication. The RemoteConnectionManager operational log records event 1149 when a user authenticates to Remote Desktop, with the source address. The LocalSessionManager operational log records 21 (session logon), 22 (shell start), 24 (disconnected) and 25 (reconnected). The Security log records 4778 and 4779 for session reconnects and disconnects. Agreement across these logs makes the remote session hard to dispute.

What ran during the session

Several sources record activity inside the session.

  • Process creation (4688), if enabled, records each new process, its parent and, if command-line auditing is on, the full command line.
  • PowerShell script-block logging (4104) in the PowerShell Operational log records the text of script blocks as they run, including decoded versions of obfuscated commands. Windows logs some suspicious script blocks as warnings even without full logging enabled. The older Windows PowerShell log records engine start (400) and pipeline execution (800).
  • Scheduled tasks: Security event 4698 records a task created (if object-access auditing for other objects is on), and the Task Scheduler Operational log records 106 (task registered), 200 (action started) and 201 (action completed).
  • Services: System event 7045 records a new service installed, and Security event 4697 records the same when audited. Attackers often install services to run code as SYSTEM.
  • Account management: 4720 user created, 4722 enabled, 4724 password reset attempted, 4738 account changed, 4728, 4732 and 4756 member added to a global, local or universal security group.
  • Removable devices: 6416 records a new external device recognized, when Plug and Play auditing is enabled, which complements the USB records from Chapter 7.
Figure 2. The lsato session on ACU-LOAN01, server time
  1. 4624 type 3, then type 10, from 10.50.8.14; 1149 and LocalSessionManager 21 agree.
  2. 4104: Invoke-Sqlcmd -Query "UPDATE Loans SET Rate=2.1 WHERE MemberId=40418"
  3. 4698 and Task Scheduler 106: task \Maintenance\LoanSync created, running a PowerShell script nightly.
  4. LocalSessionManager 24: session disconnected.

Times are from ACU-LOAN01’s own clock, which was later measured as 5 minutes 10 seconds slow. Reading 3 corrects them.

Hunting with rules: Hayabusa and Chainsaw

Reading events one by one does not scale to millions of records. Hayabusa and Chainsaw are fast open-source tools that scan EVTX files with detection rules, most written in the Sigma format, and produce a sorted list of suspicious events such as log clearing, new services, suspicious PowerShell and logons from unusual sources. Their output is a set of leads. Each one is then confirmed in the original event.

On the exam, logon type 10 means Remote Desktop, type 3 means network, type 2 means console, 4104 means PowerShell script blocks, 7045 means a service was installed and 4698 means a scheduled task was created. The next reading, Building a super timeline, puts these events on the same clock as the badge system.

Logon event 4624

Inspect the three records, then use the evidence to answer the question.

1. Logon type

10

2. Account

ACU\lsato

3. Source

IpAddress 10.50.8.14 (VPN pool)

Apply the reading

A 4624 event shows logon type 3 from the VPN address, followed a second later by logon type 10 from the same address. What sequence does that suggest?

Compare your reasoning

It is consistent with a Remote Desktop connection using Network Level Authentication, which first authenticates over the network (type 3) and then creates the interactive remote session (type 10). Confirm with the TerminalServices logs.