Chapter 13
Privilege Escalation, Pivoting and Post-Exploitation
Diploma in Cybersecurity
Ethical Hacking & Penetration Testing
•
Diploma
Privilege Escalation, Pivoting and Post-Exploitation
Introduction
A penetration test does not end when an assessor obtains an initial foothold. The more important question is what that foothold permits: Can a low-privileged account access sensitive data? Can an attacker reach another network segment? Can access survive a reboot? Can security controls detect or prevent these actions? Privilege escalation, pivoting and post-exploitation activities answer these questions within an authorised scope.
These activities are technically advanced and operationally sensitive. They can change system state, expose confidential information, interrupt services or create persistence that remains after the assessment. Consequently, they require explicit rules of engagement, careful evidence collection, continuous communication with the client and reliable cleanup. The objective is not to demonstrate maximum technical power; it is to measure realistic business impact while preserving confidentiality, integrity and availability.
This chapter presents a structured approach to evaluating local privilege escalation, persistence exposure, lateral movement, tunnelling and data-access impact. It relates common activities to the MITRE ATT&CK framework and explains how to remove test artefacts and restore systems safely.
Learning Objectives
By the end of this chapter, a learner should be able to:
Distinguish vertical privilege escalation from lateral movement and pivoting.
Assess local configuration, identity, software and control weaknesses that may enable privilege escalation.
Evaluate persistence exposure without unnecessarily installing durable access mechanisms.
Explain tunnelling and pivoting risks at a conceptual and operational level.
Measure data-access impact using controlled, minimally invasive evidence.
Map observations to relevant MITRE ATT&CK tactics and techniques.
Apply safe cleanup, restoration, evidence-handling and communication procedures.
Recommend controls that reduce post-exploitation risk.
1. The Post-Exploitation Problem
Post-exploitation is the phase after initial access in which an assessor determines the practical consequences of compromise. It includes local enumeration, privilege analysis, credential and access review, movement between systems, data-access validation, persistence assessment and controlled cleanup.
A useful distinction is:
Vertical privilege escalation: gaining greater authority on the same host, such as moving from a standard account to root or local administrator.
Horizontal movement: using one compromised identity or host to access another host at a similar privilege level.
Lateral movement: the broader process of moving through an environment, often by abusing legitimate credentials, remote services or trust relationships.
Pivoting: using a compromised system as an intermediary to reach networks or services that the assessor’s original system cannot directly access.
Post-exploitation: the complete assessment of what can be done after initial compromise, including impact validation and restoration.
These categories overlap. For example, a compromised workstation may provide a route to a server, while a service account found on that workstation may permit access to a database. The assessor must document the chain rather than treating each event as an isolated vulnerability.
A practical impact chain is:
Initial access → local discovery → privilege opportunity → credential or trust exposure → pivot or lateral movement → data-access validation → risk conclusion → cleanup
The chain should be interrupted as soon as sufficient evidence exists. Continuing further merely to demonstrate additional capability increases risk without necessarily improving the finding.
2. Rules of Engagement and Safety Boundaries
Privilege escalation and post-exploitation require more specific authorisation than ordinary vulnerability scanning. The rules of engagement should identify:
authorised organisations, hosts, accounts, applications and network ranges;
permitted testing windows and emergency contacts;
prohibited actions, such as destructive modification, denial-of-service testing, mass password attempts or access to personal records;
whether production data may be viewed, copied or only metadata-validated;
approved test accounts, synthetic data and canary files;
restrictions on credential handling and storage;
stopping conditions and escalation procedures;
backup, rollback and restoration responsibilities;
evidence-retention and secure-destruction requirements.
A sound principle is minimum necessary action. If a file listing proves that sensitive records are accessible, downloading the records is normally unjustified. If a read-only configuration proves excessive privilege, changing the configuration is normally unnecessary. Demonstration should be proportional to the question being answered.
Before testing, the assessor should establish a baseline: system availability, running services, authorised accounts, scheduled tasks, security alerts and relevant configuration. A baseline makes later cleanup and attribution possible.
3. Local Privilege Escalation
Local privilege escalation occurs when a user or process obtains permissions beyond those intentionally assigned. It may result from a vulnerability, insecure configuration, excessive rights, exposed credentials or a design flaw.
3.1 Main Classes of Weakness
Class
Typical exposure
Assessment question
Operating-system weakness
Missing security updates or vulnerable components
Is the host susceptible to a known, relevant vulnerability?
Misconfiguration
Writable privileged files, unsafe services or excessive permissions
Can a low-privileged identity influence a privileged process?
Identity and credential weakness
Reused passwords, cached secrets or overprivileged service accounts
Can existing credentials provide higher authority?
Application weakness
Unsafe input handling or insecure local interfaces
Can an application be induced to perform a privileged action?
Task and service weakness
Insecure scheduled jobs, startup items or service paths
Can an unprivileged user alter code executed by a privileged context?
Hardware or boot weakness
Weak boot controls or exposed recovery functions
Is physical or administrative access able to bypass host controls?
A professional assessment begins with enumeration, not exploitation. The assessor reviews effective identity, group membership, operating-system version, installed software, services, scheduled tasks, startup mechanisms, file and directory permissions, security policies, environment variables, secrets in configuration files and local network exposure. Enumeration should be read-only wherever possible.
3.2 Reasoning About Exploitability
A suspected weakness is not automatically a valid finding. The assessor should establish:
Precondition: What access is required?
Influence: What can the low-privileged user control?
Execution context: Which account or process performs the action?
Boundary crossed: What additional authority becomes available?
Reliability: Is the result consistent and repeatable in the approved environment?
Impact: What systems or data become reachable?
Detectability: Which controls should have observed the activity?
Remediation: What change removes or reduces the condition?
For example, a writable script executed by a privileged scheduled task may represent a genuine escalation path only if the task runs under a more powerful account, the script is executed under the relevant conditions and the user can modify it without a separate control preventing execution. The report should describe this chain without including unnecessary weaponisation detail.
3.3 Linux and Windows Assessment Themes
On Linux and Unix-like systems, common review areas include set-user-ID and set-group-ID files, unsafe capabilities, writable service definitions, scheduled jobs, container permissions, insecure sockets, exposed credentials and weak file ownership. On Windows, relevant areas include service configurations, scheduled tasks, access-control entries, unquoted service paths, registry-based startup locations, token privileges, delegated rights, stored credentials and patch status.
These are assessment themes rather than automatic vulnerabilities. Modern operating systems may include controls such as mandatory access control, application allow-listing, protected services, credential isolation and endpoint detection. A finding must therefore be validated against the actual host and security configuration.
3.4 Safe Validation
Validation should preferably use a non-destructive proof, such as recording the effective identity, demonstrating read access to a synthetic protected file or obtaining a permitted configuration value. Avoid modifying system binaries, disabling security software, changing passwords, creating hidden accounts or installing persistent agents unless the client has explicitly authorised those actions and a rollback plan exists.
4. Persistence Exposure
Persistence is the ability to retain access after a session ends, a user logs out or a system reboots. In a real intrusion, persistence is valuable to an attacker; in an assessment, it is a high-risk activity because test artefacts may outlive the engagement.
Persistence exposure can be evaluated in two ways:
Configuration assessment: identify mechanisms that an attacker could abuse, without creating a persistent foothold.
Controlled proof: use a clearly labelled, time-limited mechanism in a laboratory or explicitly approved environment, with an immediate rollback procedure.
Relevant mechanisms include startup items, scheduled tasks, services, user profiles, authentication-provider changes, cloud tokens, application plug-ins, remote-management accounts and alterations to identity infrastructure. The assessor should record the required privilege, trigger condition, execution identity, visibility to defenders and removal method.
Persistence risk is increased by:
unrestricted administrative rights;
weak separation between administration and ordinary use;
long-lived tokens and unmanaged secrets;
poor monitoring of scheduled tasks and service changes;
unapproved remote-management tools;
inadequate configuration baselines;
lack of centralised logging and change control.
The safest default is to prove possibility, not to establish durable access. A report can state that a user could create a scheduled task because the relevant permission exists, supported by a configuration record, rather than leaving a task behind.
5. Pivoting, Tunnelling and Lateral Movement
A segmented network may prevent direct access from the assessor’s workstation to an internal service. If an authorised foothold exists inside the segment, the assessor may be permitted to test whether that host can act as an intermediary. This is pivoting.
Tunnelling encapsulates or forwards traffic through an intermediary. It can be implemented by port forwarding, a proxy, a virtual network interface or an application-layer relay. The security concern is not the particular tool but the trust boundary it bypasses: a host with access to two zones may connect systems that network administrators intended to isolate.
A conceptual model is:
Conceptual pivoting path across segmented networks
Figure: Conceptual pivoting path across segmented networks
Figure: A conceptual pivoting path through a compromised intermediary; the intermediary does not automatically authorise access to every internal service.
Pivoting should be narrowly scoped. The assessor should specify target addresses, ports, protocols and test duration. Broad discovery scans through a pivot can overload fragile systems and generate unnecessary alerts. Testing should use one or a few representative services before expanding the scope.
Lateral movement commonly abuses legitimate remote services and trust relationships. Examples include remote administration, file sharing, directory services, database connections, virtualisation platforms and cloud-management interfaces. The assessment should determine whether access is possible, which identity is used, what authorisation is obtained and whether monitoring records the event. It should not collect unrelated credentials or access systems outside the approved inventory.
6. Data-Access Impact
The presence of a technical path does not by itself establish business impact. Impact analysis connects permissions to assets, data classifications and organisational consequences.
A useful evidence hierarchy is:
Metadata evidence: filename, ownership, classification label or database schema.
Minimal content evidence: a synthetic record, redacted field or small approved sample.
Controlled retrieval: a limited, logged copy authorised by the client.
Full extraction: exceptional and generally inappropriate unless expressly required.
The assessor should identify confidentiality, integrity and availability consequences. Questions include:
Can sensitive data be read, modified, deleted or exported?
Is the data subject to privacy, financial or sector regulation?
Can an attacker alter trust decisions, payroll, access rights or operational records?
Does the path reach backups, keys, identity systems or management planes?
Could the action affect safety or service continuity?
Evidence must be protected as sensitive information. Store it in approved locations, restrict access, encrypt where required, avoid embedding secrets in reports and securely destroy temporary copies after acceptance of the findings.
7. MITRE ATT&CK as an Assessment Language
MITRE ATT&CK provides a knowledge base of adversary tactics and techniques. It is not a checklist and does not determine severity by itself. It helps relate observed behaviour to a common vocabulary and supports detection engineering.
Relevant Enterprise ATT&CK mappings may include:
Assessment activity
Illustrative ATT&CK relationship
Local privilege escalation
Privilege Escalation tactic; exploitation of vulnerabilities or abuse of elevation mechanisms
Credential discovery
Credential Access tactic; discovery of credentials or password stores
Internal service discovery
Discovery tactic; network service scanning or system-network discovery
Remote administration
Lateral Movement tactic; remote services
Proxy or forwarded connection
Command and Control tactic; proxy-related techniques
Scheduled task or service used for retention
Persistence tactic; scheduled task/job or service mechanisms
Collection of approved evidence
Collection tactic; data from local or network sources
Removal of test artefacts
Defensive action and assessment procedure, not evidence of attacker behaviour
Mappings should be precise. The report should state the observed action, host, identity, timestamp, precondition, result and relevant technique identifier where appropriate. Do not claim a technique merely because a tool is capable of performing it. ATT&CK describes behaviours, not brands of software.
ATT&CK mapping also supports blue-team improvement. For each finding, identify expected telemetry, such as process creation, task or service modification, authentication events, administrative-group changes, proxy connections and unusual access to sensitive repositories. Then assess whether the organisation generated, retained and reviewed that telemetry.
8. Operational Workflow
A disciplined workflow reduces both technical and legal risk.
Phase 1: Prepare
Confirm authorisation, scope, contacts, test identities, time window, data rules, emergency procedures and rollback plans. Establish a baseline and create an action log.
Phase 2: Enumerate
Perform read-only discovery of identity, privileges, services, tasks, software, network routes, security controls and accessible data locations. Record commands or methods sufficiently for reproduction, but do not place secrets in notes.
Phase 3: Form and rank hypotheses
Rank possible paths according to confidence, expected impact, operational risk and evidential value. Prefer the least intrusive test that can answer the question.
Phase 4: Validate
Test one path at a time. Capture timestamps, source and destination, identity, result and supporting evidence. Stop when the finding is proven or when the risk exceeds the approved threshold.
Phase 5: Assess movement and impact
Only where authorised, test a narrowly defined pivot or lateral path. Use synthetic or minimal data evidence. Avoid broad extraction and avoid changing credentials or security controls.
Phase 6: Clean up and restore
Remove accounts, keys, tasks, services, files, routes, proxy settings, temporary data and test modifications. Restore approved configuration and verify the baseline.
Phase 7: Report and communicate
Explain the attack path, business impact, evidence, ATT&CK relationships, detection opportunities, remediation and residual risk. Notify the client promptly if critical exposure or unexpected sensitive-data access occurred.
9. Cleanup and Restoration
Cleanup is a technical and governance obligation, not an optional courtesy. The assessor should maintain a live artefact register containing:
host and environment;
artefact type and location;
creation or modification time;
purpose;
original state or backup reference;
removal or restoration method;
verification result;
responsible person and timestamp.
Potential artefacts include temporary files, scripts, test accounts, authentication keys, scheduled tasks, services, firewall rules, routes, proxy configuration, modified permissions, downloaded samples, cloud tokens and changes to monitoring settings.
Restoration should follow the principle of change reversal, not guesswork. Compare the final state with the baseline and approved change records. Where an original value is unknown, do not invent one; escalate to the system owner and use an approved configuration source.
Verification may include checking that test identities no longer authenticate, temporary processes are absent, tasks and services match the baseline, routes and firewall rules are restored, no test files remain, logs remain intact and applications function normally. Security logs should not be deleted to conceal assessment activity. If test noise must be distinguished, document it through the agreed process.
A final handover should state what was removed, what could not be removed, what was restored by the client, what evidence remains and what residual risk exists.
10. Applied Case: Illustrative University Research Network
Background
A university authorises a controlled assessment of a research workstation and one internal data service. The test account is a standard user. The rules prohibit destructive actions, bulk data copying, password changes and access to student records. Synthetic research files are available for validation.
Problem
The university wants to know whether compromise of a researcher workstation could lead to administrative control of the host or unauthorised access to a restricted research repository.
Analysis
Read-only enumeration shows that a privileged scheduled process executes a script located in a directory writable by the research group. The workstation also has network reachability to the research segment. A service account used by a research application has broader repository permissions than required.
The assessor does not replace the script or retrieve research data. Instead, the team documents the ownership and permissions, validates the effective execution identity through an approved non-destructive test, and accesses a designated synthetic file in the repository using the permitted test path.
Approach and solution
The findings are mapped to privilege escalation, scheduled-task abuse, valid-account or service-account exposure, remote-service or internal-access behaviour and collection of approved data, with exact ATT&CK sub-techniques selected according to the observed implementation. The team recommends:
placing privileged scripts in an administrator-controlled directory;
restricting write permissions and implementing integrity monitoring;
reducing the service account to least privilege;
separating research and administrative network paths;
enforcing stronger authentication for privileged access;
alerting on task changes, unusual repository access and service-account use from workstations;
reviewing repository permissions and synthetic-data test procedures.
Outcome
The team removes no production code and leaves no persistence. It records the evidence, confirms that the synthetic file was the only content accessed, verifies that the workstation baseline is unchanged and provides a remediation-prioritised report.
Learning points
The case demonstrates that impact can be proven without full exploitation or data extraction. It also shows why privilege escalation, lateral movement and data exposure must be analysed as a connected chain. The most serious weakness is not necessarily the first technical defect; it may be the trust relationship that converts a workstation compromise into repository access.
11. Challenges, Limitations and Professional Judgement
Post-exploitation testing has unavoidable limitations. Permissions may vary by time, identity, endpoint state or network location. A non-exploitative test may demonstrate exposure without proving every possible consequence. Conversely, a successful exploit in a test environment may not reproduce reliably in production.
Common challenges include incomplete asset inventories, undocumented legacy systems, fragile operational technology, encrypted traffic, cloud control-plane complexity, endpoint detection interference and uncertainty about data ownership. The assessor should state assumptions and confidence levels rather than presenting uncertain conclusions as facts.
Automation can accelerate enumeration and correlation, but automated exploitation or broad discovery may create unacceptable risk. Artificial intelligence can assist with log classification, attack-path analysis and report drafting, but outputs require human validation. Sensitive evidence must not be placed in an unapproved AI service, and generated mappings or remediation advice must be checked against current system facts and authoritative framework versions.
12. Governance, Legal and Ethical Considerations
Authorisation must be explicit, current and sufficiently specific. Testing outside scope can constitute unauthorised access even when the assessor has good intentions. Privacy principles require data minimisation, purpose limitation, access control and secure disposal. Contractual obligations may impose additional requirements for cloud providers, regulated data or third-party systems.
Ethically, the assessor should protect the client from avoidable harm, disclose material risk promptly, preserve evidence integrity and avoid overstating results. Conflicts of interest should be declared. If unexpected personal data or credentials are encountered, access should stop at the minimum necessary point and the agreed incident or privacy process should be followed.
13. Best-Practice Checklist
Obtain written, technically specific authorisation.
Establish a baseline before changing anything.
Prefer read-only enumeration and synthetic data.
Validate the smallest sufficient attack path.
Record identities, timestamps, hosts and actions.
Restrict pivoting by target, protocol and duration.
Do not create persistence unless expressly approved.
Protect evidence as sensitive information.
Map observed behaviour, not merely tool capability, to ATT&CK.
Maintain an artefact register and reversal plan.
Verify restoration independently.
Report limitations, residual risk and detection opportunities.
Chapter Summary
Privilege escalation determines whether a limited foothold can become administrative control. Pivoting and lateral movement determine whether that foothold can cross network, identity or application boundaries. Persistence exposure measures whether access could survive normal session termination, while data-access analysis connects technical permissions to confidentiality, integrity and availability consequences.
Safe post-exploitation is governed by scope, proportionality and evidence discipline. Assessors should enumerate before acting, validate the least intrusive path, use synthetic or minimal data, avoid unnecessary persistence and map observed behaviour to MITRE ATT&CK accurately. Cleanup requires a documented artefact register, comparison with the baseline, restoration of approved configuration and verification that test access no longer exists. The professional outcome is not maximum compromise but a defensible explanation of realistic risk and practical remediation.
Key Terms
Privilege escalation: Obtaining authority beyond the permissions intentionally assigned to an identity.
Vertical escalation: Increasing privilege on the same host or service.
Lateral movement: Moving from one system or account to another within an environment.
Pivoting: Using a compromised intermediary to reach otherwise inaccessible networks or services.
Tunnelling: Forwarding or encapsulating traffic through an intermediary.
Post-exploitation: Assessment activities performed after initial access.
Persistence: The ability to retain access after a session ends or a system restarts.
Rules of engagement: Authorised boundaries, methods, timing and restrictions for a test.
Least privilege: Granting only the access necessary to perform an approved function.
Attack path: A connected sequence of weaknesses and actions leading to an impact.
Synthetic data: Artificial data created for safe testing.
Artefact register: A record of test-created or test-modified items and their restoration status.
MITRE ATT&CK: A knowledge base describing adversary tactics and techniques.
Credential exposure: Unauthorised availability or use of authentication material.
Remote service: A service that permits interaction with another host over a network.
Data minimisation: Limiting data access and collection to what is necessary.
Baseline: A documented reference state used for comparison and restoration.
Residual risk: Risk remaining after controls or remediation are applied.
Review Questions
Short Answer Questions
Distinguish vertical privilege escalation from lateral movement.
Why should an assessor prefer metadata or synthetic data when validating access?
What is the purpose of a baseline in post-exploitation testing?
Explain why pivoting must be restricted by target and protocol.
What information should an artefact register contain?
Long Answer Questions
Explain a complete, safe workflow for assessing local privilege escalation.
Discuss how persistence exposure can be evaluated without leaving durable access.
Explain how MITRE ATT&CK improves reporting and defensive detection.
Analyse the relationship between a compromised workstation, service-account permissions and repository exposure.
Discuss the ethical, legal and governance issues associated with post-exploitation activities.
Analytical / Application Questions
An ordinary user can modify a file executed by a privileged scheduled task. Identify the conditions that must be verified before reporting a privilege-escalation path, and propose a minimally intrusive validation method.
A workstation can reach a restricted database through a dual-homed server, but the assessment scope includes only one database host. Design a safe pivot test and specify stopping conditions.
During testing, an assessor discovers a token that may access personal records. Explain the immediate actions, evidence-handling controls, impact-validation method and cleanup steps that should follow.
Multiple Choice Questions with Answers
Question 1
Which activity is an example of vertical privilege escalation?
A. Using a workstation to reach a database server
B. Moving from a standard account to local administrator on the same host
C. Forwarding traffic through an intermediary host
D. Reading a synthetic file in an approved repository
Correct Answer: B. Moving from a standard account to local administrator on the same host
Question 2
What is the safest default for validating persistence exposure?
A. Install an untracked backdoor and remove it later
B. Create multiple administrator accounts for redundancy
C. Assess the configuration without creating durable access
D. Disable endpoint protection before testing
Correct Answer: C. Assess the configuration without creating durable access
Question 3
What does pivoting involve?
A. Using a compromised intermediary to reach another network or service
B. Encrypting all evidence with a public key
C. Restoring a host to its baseline
D. Changing a user password after compromise
Correct Answer: A. Using a compromised intermediary to reach another network or service
Question 4
Which evidence is generally least intrusive for proving data exposure?
A. A complete export of the database
B. A copy of every accessible document
C. A metadata record or approved synthetic file
D. Deletion of the accessible records
Correct Answer: C. A metadata record or approved synthetic file
Question 5
What is the primary purpose of an artefact register?
A. To list all vulnerabilities in the internet
B. To record test-created or modified items and their restoration status
C. To replace written authorisation
D. To conceal testing activity from defenders
Correct Answer: B. To record test-created or modified items and their restoration status
Question 6
How should MITRE ATT&CK be used in a penetration-test report?
A. As proof that a tool is automatically malicious
B. As a vocabulary for mapping observed adversary-like behaviour
C. As a substitute for risk analysis
D. As a guarantee that an attack will succeed
Correct Answer: B. As a vocabulary for mapping observed adversary-like behaviour
Question 7
Which action best follows the principle of minimum necessary action?
A. Downloading all sensitive files after proving read access
B. Changing production passwords to demonstrate control
C. Using a synthetic record to validate authorised access
D. Scanning every network segment through a pivot
Correct Answer: C. Using a synthetic record to validate authorised access
Question 8
Why is a baseline established before post-exploitation testing?
A. To ensure every system has identical software
B. To support comparison, cleanup and restoration
C. To eliminate the need for authorisation
D. To prevent all security alerts
Correct Answer: B. To support comparison, cleanup and restoration
Question 9
Which factor most directly increases persistence risk?
A. Short-lived test notes
B. Centralised logging with alert review
C. Long-lived tokens and unmanaged secrets
D. Synthetic data in a controlled repository
Correct Answer: C. Long-lived tokens and unmanaged secrets
Question 10
What should an assessor do after unexpectedly encountering personal records?
A. Copy the entire dataset for later analysis
B. Continue until every record type is identified
C. Stop at the minimum necessary point and follow the agreed privacy process
D. Delete the records to prevent further access
Correct Answer: C. Stop at the minimum necessary point and follow the agreed privacy process
Ethical Hacking & Penetration Testing
Chapter 13
of 15