XSS in steam react chat client
The Steam Chat client allowed users to send BBCode [url] tags that created links with arbitrary schemes, including steam:// and custom Windows protocols. By chaining this with a whitelisted CodePen embed and the undocumented steam://openexternalforpid URI, an attacker could achieve remote code execution on a victim's machine.
- Fixed in 21 days
- Paid in 21 days
- Disclosed after 4 months
Summary by the researcher
1. Background
The Steam Chat client is a particularly interesting system to attack because it's built using a modern set of technologies with strong security characteristics.
It's built on React, which has some of the strongest security characteristics of any modern Javascript application framework, and avoids use of the unsafe dangerously family of functions well.
Content Security Policy is deployed, although with unsafe-inline. This is a minor inconvenience but an interesting step forward.
The Chat client, unlike most desktop applications using web technologies runs in a custom, highly locked down build of Chrome Embedded Framework. In most Electron-like systems, privileged access is granted to the Javascript VM via the window object. The chat client takes the interesting and potentially much more secure approach of running at, in essence the privilege of a regular webpage allowing privileged actions only through PostMessage and a loopback WebSocket that communicates with the parent process.
The WebSocket carries a custom binary protocol that is very difficult to dissect over the wire and it's leveraged such that through some common bug I have yet to find root cause on Chrome Dev Tools crashes if breakpoints fire as the page loads (I think it's some kind of race that happens when WebWorkers are active and the Javascript assets are heavy).
The trend toward DOM heavy applications is interesting to me, as many in the security industry still rely heavily on HTTP proxies that aren't able to accurately reflect application state in these cases.
2. Techniques
2a. React Security Gotchas
Since the Steam Chat client is built on React, there's far fewer ways XSS is possible. There are a few ways I look for particularly:
-
React does not special-case encode the attributes of any tags. Attributes with DOM manipulation properties are dangerous.
It's very common to see
<a href>attributes generated from user input wherejavascript:input URIs, when clicked will result in XSS. Hand-rolled countermeasures tojavascript:URIs are still poor, and often employ URL parsers that are not intended to be used defensively.It's not uncommon to see
styletags generated by string concatenation that include user input where an image, for example as a background URL can be injected to IP address information and tokens from the URL via Referer header. CSS sanitization isn't really a thing, even in the best contextually-aware XSS libraries. CSS-based attacks on the DOM that useselector[value=string]or that define fonts that make HTTP requests for each character to conditionally load resources and exfiltrate data are almost entirely unknown outside infosec circles. -
React doesn't attempt to provide hardened versions of other unsafe Javacript functionality, or disable them. It's common to see React applications use
document.location = xxxto change the location of the browser which is also vulnerable to Javascript URI injection.In the same vein, requests to HTTP APIs don't gain enhanced security from React. It's still common to request data using user input spliced into a URL that's not encoded properly. React developers love to use fancy REST syntax to generate request paths like
"/user/" + encodeURIComponent(username) + "profile", even though to my knowledge there's no safe way to encode a URL path in vanilla Javascript. Even where../is encoded to..%2F, virtually all web servers ignore the lexical difference between%2Fand/. -
Some protocols, like OEMBED are just unsafe by design by returning HTML. To use these APIs, React apps including this one have to use
dangerouslySetInnerHTML. It's also not uncommon to see React refs used to get a handle on the generated element andinnerHTMLcalled directly, which can evade testers grepping for 'unsafe'.Protocols that return HTML, and even those that don't still routinely return
Content-Type: text/html, which means that if a victim is navigated to an API result for example by submitting an HTML form even if the client would handle the output safely, the browser won't if an XSS exists.
2b. Advanced DevTools Features
I wanted to throw in a few DevTools features that my infosec friends don't use enough that I found instrumental to finding this bug. Hackerone doesn't support uploading images to summaries, so I'll link them instead.
2b I. The Console Drawer
https://zemn.me/misc/devtools_pullout.png When you press escape with devtools open, a drawer pulls up from the bottom. From here, you can get access to some insanely powerful features while still browsing source code or network logs.
https://zemn.me/misc/devtools_pullout_console.png The most insane feature is the pull-out console. When a breakpoint is fired and execution is paused, you can execute any code you want here and it will execute in the context of the current line the debugger is on. This is absolutely indispensable for modifying and inspecting code that operates at many levels of abstraction.
2b II. Code Search, Pretty Print
https://zemn.me/misc/devtools_search_steam.png DevTools contains an extremely powerful search feature that searches every asset loaded into the current window. It can be accessed by the bottom drawer (click the three dots). If you find an element in the DOM and wonder how it's generated, you can search for it here and jump to where it's mentioned.
Once there, you'll likely want to hit the pretty print button {} in the bottom left and ctrl-f for anything in that file you might find interesting.
2b IV. Breaking on Events
https://zemn.me/misc/devtools_breakpoints.png
It's super common that you have some event you expect to happen, like an XHR or a postMessage but you don't know where the handler is defined. Do not worry! If you scroll to the bottom of the rightmost panel of Sources you can set breakpoints for XHR / fetch and event listeners.
2b V. The Call Stack
https://zemn.me/misc/devtools_callstack.png In the 'Sources' panel, once a breakpoint fires, you get the full callstack up to the breakpoint on the right. Sure, you get this in most languages.
Let's say you know a user action calls an XHR eventually, but you want to find the high-level construction of the XHR request. If you set an XHR / fetch breakpoint you'll end up breaking deep in a library of some kind usually that provides little context.
You can actually now step back through the call stack by clicking on each call, viewing code, variables in scope and which file it's in as you go until you find something that looks specially written for this application. I find this indispensable for escaping library call hell in modern minified applications.
2b VI. Injecting Code
https://zemn.me/misc/devtools_conditional_breakpoint.png While chrome devtools does have the ability to edit the code of Javascript in webpages on the fly, this doesn't work for minified code, because you cannot do this on pretty-printed files. You can, however use a special trick.
If you right-click on a line number you can use 'insert conditional breakpoint'. Conditional breakpoints are fully featured javascript that breaks when the statement is true. console.log always returns undefined, so if you want to inspect several values as a program runs, you can inject console.log calls to have their values printed to console, something that isn't possible with the similar but less effective 'watch' feature.
In systems that have a heartbeat, a breakpoint will often cause a disconnection. Using conditional breakpoints can allow you to add code without stopping execution and using the console.
2b VII. Network Search
https://zemn.me/misc/network_search.png Sure you're getting some data from somewhere, but have no idea where? You can click the magnifying glass icon in the network panel to search full requests, responses and their headers.
2b VIII. Network Filter Expressions
In applications that send a lot of XHR requests, especially those that regularly poll it can quickly become impossible to navigate all the requests in the network panel. You can use filter expressions to narrow down requests to those that you might find important.
2b IX. Copy as Curl
There's a ton of things you can do with devtools, but you generally can't bypass web security primitives like same-origin policy, and it's not at all easy to remake and customize requests. You can click on any request in the network panel and go to 'copy as curl' to get an exact replication of the request you can iterate on to mess with the request form.
3. Approach
In a typical, last-generation chat application, security issues are most likely to surface where HTML is generated from input text. After all, not only is parsing language a super hard problem but it's especially hard to provide the power of HTML features to the user without inadvertently allowing them control over the browser by manipulating these features.
3a. Recon
My first realisation was that the app deployed inside the Steam desktop app was the same as the online one at https://steamcommunity.com/chat, which made it much easier to inject DevTools into the testing flow.
After that, I spent a little time using chat with DevTools' Network panel open and observed that we weren't getting bombarded with XHR polling. This likely meant we were using a WebSocket. Refreshing the page with the Network panel open (you only see WebSocket connections if you see them open), I browsed to the WS panel and noted that the client was communicating over completely unintelligible binary frames.
Noticing that the chat system supported embedded content which is unbelievably difficult to implement securely, I started doing code searches for 'OEMBED' and other generic embedding systems that are super easy to get XSS on.
At this point, I discovered the application was a React app, and switched to, at least partially using the React Chrome Extension to inspect the DOM. The extension makes it super easy to jump to the code which generates elements, and since React components express all the information they depend on as props (which can be inspected in the extension) I found it much easier to get a handle on application structure.
I did a few searches for dangerously, innerHTML etc, and set breakpoints on all those. I tried to then get those functions to fire by tracing the call stack up. dangerously was only really called for certain 'oembed elements' that could be sent by the chat server.
I set up breakpoints on XHRs & other events that were fired by loading OEMBED content, like YouTube. When these fired, I stepped back through the call stack to reach the function which sanitised user input and sent it to the chat servers via binary WebSocket.
3b. Reaching XSS
This proved to have surprising results. I'd end up with the breakpoints firing twice for each sent message: once when the user makes a send request, and the client writes an assumed server response to the DOM – and a second time when that was overwritten by the actual response the server sent back. These renders could differ significantly under certain circumstances, in particular when OEMBED was used.
If I send a Vimeo link in chat, the client renders that initially as an HTML link when the message is sent. Then, when the server updates the chat room, it'll replace the link with a BBCode (yes, bbcode!) [OEMBED] tag that is essentially just raw HTML.
I immediately jumped at this and, using a breakpoint after the call to sanitize user input of BBCode I tried sending OEMBED tags containing malicious HTML, hoping they would be reflected back by the server. However, the server would completely strip these tags before responding.
After some scanning of the code, I located the table that matched BBCode tags with their corresponding React components and sent every BBCode tag I saw with mixed results. Most tags were stripped out by the server, and many tags clearly needed attribute parameters [imgur alt=] etc I didn't know how to use.
I pivoted to trying to log the BBCode representation of all the rich text commands like rolling a random number or showing an image to little success. I discovered a small handful of tags I could send that would otherwise be stripped including [url=xxx], [code], and [image]. Image was heavily locked down and I found it nearly impossible to use it in a malicious way. [code] just safely generated [code] tags, but [url=xxx] was legitimately making links to anywhere, including javascript: URI links.
I immediately opened this report, saying that I'd reached XSS and this usually results in RCE in such clients. It turned out to be a lot more complex than that.
Sure, I had reached XSS and I could really mess with web browser users but the javascript: URI was found to actually be smartly stripped or not honoured by the custom Steam client browser. I started trying other approaches, knowing that I could form any URL.
3c. The Steam URI
Based on prior art, I started by using steam:// URIs, which are unique to the steam client and can do a lot of bad stuff. Many years ago, in-browser steam:// URIs were used to reach Remote Code Execution by installing, and then running a game and piping its carefully crafted logs to the startup folder.
I had minor success. In the Chat client, steam:// URIs were executing in a privileged context browsers could not normally access. After the steam:// security issues, valve added a prompt for if the URL was opened by an external system – if I send you steam://open/440 in a web browser, it'll cause steam to confirm that you really want to open that game, but these links in the Steam chat client would cause no such confirmation.
I played around with making links that variously opened games on people's computers, reset their configurations, closed steam or opened systems on it like the steam console by running steam://-console or something. I don't remember what the actual URL is :p
3d. Abusing OEMBED
After much trying and headdesking I changed tack again and tried to target OEMBED specifically. Secure OEMBED systems are hard as hell to implement, so people usually just use a service like Embedly. Embedly's security comes from good use of iframe sandboxing, and whitelists. However, since we're not in a normal browser, being embedded gives you different privileges. If you're embedded in an Electron desktop app browser and the iframe isn't in a special <WebView>, one can still access all the dangerous electron APIs through our iframe's window object even if the iframe would be safe in a browser.
To abuse this, though I'd need to either (1) get whitelisted by embedly (impossible) or (2) find a javascript injection in a whitelisted embedly embed. In a stroke of luck, I remembered that codepen.io is whitelisted by embedly and codepen is, well literally Javascript injection as a service.
In the past, working in such contexts was something I literally did by injecting the script for FireBug, but this is usually a pain because stuff doesn't work quite right. @mandatory recommended I use a remote chrome console. He recommended me some software i completely forget the name of that lets you use a chrome dev tools remote console by injecting some scripts.
3e. Remote Console
Once I had loaded in Steam my codepen.io app with my remote console, I started looking for idiosyncrasies of the Steam Web Helper context. I started by dumping Object.keys(window) and running a diff off it against a normal Chrome browser. This came up with a few things, most of which were useless. I could hook an event for when some styles loaded on the page and other stuff that's not usually possible in the browser, but not really a security issue.
Since the Chat client communicates with a parent window to perform privileged operations like pulling the friends list, I tried doing window.top.postMessage() with the postMessage commands it used to try to coax the client into doing something bad. It seems like the sandboxed context produced by the OEMBED system prevented access to window.top.
At this point, I'd started using the remote console to rapidly test the effects of steam:// URIs by issuing open("steam://xxx"). I didn't find out much more than I had before, but it pushed me to start dissecting the Steam Web Helper Binary a little bit more. I started by running a binary grep in the Steam folder for Steam protocol URIs I knew existed, then I used vim to search for string tables containing these. These led me to a couple of interesting undocumented URIs particular to the Steam Web Helper.
3f. Through an Open Window
Two particularly interesting URIs included a Chrome Dev Tools URI I hoped might have some level of privilege and the URI steam://openexternalforpid which appeared as steam://openexternalforpid/%s/%s in the application binary. The Chrome Dev Tools URI did weird stuff. When I opened it, it opened a single pixel wide black window as many times as I wanted. From the string of openexternalforpid it was clear that it required two parameters, but I was at a total loss as to how to work out what they were.
After much guessing myself, I passed the openexternalforpid stuff onto my friend @XMPPWocky an extremely capable binary reverse-engineer whom I've found serious Steam bugs with before, but he found it difficult to make much of it with the little time he could spare from saving the world or whatever at Symantec.
I had a thought about the context in which this Javascript was executed. Opening a window is often specially implemented for an embedded browser, and it's pretty frequent that an opened window has different privileges to the opener window. I tried grabbing open('steam-chrome-dev-tools://something').contentWindow or whatever the URL was to see if I could grab a privilaged devtools window. With interesting results.
New windows did actually have special functions not normally accessible. I could read where the user's cursor was, maximise the window, minimise it and a bunch of other junk none of which brought me closer to remote code execution after hours of testing.
3g. Beyond Protocol
In my testing of the Steam:// protocol I noticed something interesting: whenever I made a typo, Windows would open up a dialog saying, for example that it did not know how to open the file type sream: or something. That was interesting to me.
Custom protocols like Steam are implemented by a ton of different pieces of software. They're usually Very Bad, and their security relies on the browser prompting to open this application. Back when everyone used Skype, I had some amusing fun sending people skype://call urls which opened calls to the loopback skype number that just echoes what you say.
But like, people don't actually have Skype these days so I was wondering what other custom protocols might be implemented on my system I could leverage. This turned out to be an absolutely fascinating rabbit hole into windows internals. I spent hours trawling forums and reference documents describing how to add protocols and what protocols were registered by windows. Turns out, there's quite a few. Windows even has custom protocols for opening maps to places for the user to look at.
Then I went deeper. The custom protocols are actually implemented in the Windows Registry in HKEY_CURRENT_CLASSES or something. It's truly fascinating how telling the structure of this system is. Not only is in this directory every protocol (like, for example, what opens when you open an http:// link on Windows), but this folder actually contains the file type associations for every filetype in windows, like how Notepad opens if you open a .txt file.
The folders for http: protocols and others are sitting right by the folders for .png, and they follow the same syntax, describing how arguments get turned into a program invocation. In complete disbelief, I pressed win+R and typed .txt:hello ... and it opened Notepad. Custom protocols and filetype associations are the same thing.
After that, I scoured the entire class for stuff I might find useful in smarter ways each time. I made a beeline for the .bat filetype which runs arbitrary Windows commands and tried it in Run. It crashed Windows Explorer.
I got smarter and started searching for filetypes that would take the 0th argument and open it with the program, because from reading how protocols opened it was clear that if the 0th argument was called $0, protocols like http:// are essentially open_webbrowser.exe $0 where $0 would be the URL.
I came across some truly bizarre sights I wish to share with you aall. There's a calculator protocol. I don't know why, but there is. If you wanna be fancy and show popping a calculator, you can literally make a link to calculator: like <a href="calculator:">click me!</a>, which, when clicked will open the calculator on the victim's computer.
I spent absolutely hours trawling this damn database and found a few potentially exploitable protocols. One is jarfile:, which executes the jarfile you give it. It's actually the binding for the .jar filetype. Another one, JSEFile: is a windows xp-era system that let you run an HTML page with VB script like a program. Like prehistoric electron or something.
It... wasn't working. The problem is that $0 included the full URI. If I make a link to jarfile:c:/windows/whatever.exe, the actual invocation is like c:/Program Files/Java/Java.exe jarfile:c:/windows/whatever.exe, and well... it tries to find a directory called 'jarfile:c:', which obviously doesn't exist.
I took a break and submitted another ticket, stating that I'd found another interesting method via this means, and I could open any program on their computer, though not with the arguments I might want. I was so sure this was a way to RCE. At the very least I could submit an example that launched calculator.exe, which is what all the cool kids do, right?
Almost immediately I had an epiphany. Directory traversal. If it's looking for a directory called 'jarfile:c:' that doesn't exist, we can inject a ../ to say 'go one directory back' and negate the directory that doesn't exist. This was actually a pretty great success. I could send like jarfile:..\..\..\..\..\..\..\..\Users\Username\Downloads\drive-by-download.jar and actually legitimately run a jar file on the victim's computer. This was simultaneously exciting and disappointing as it meant I couldn't load a jar file remotely. I'd need to get the user to donwload it.
3h. openexternalforpid
This whole time, i had the Steam Console open (opened with steam://console, I think). I wasn't reading it, but it was printing a lot of useful information, like, in particular what steam:// invocations it was running. I tabbed onto the console accidentally and by absolute sheer luck, I saw something. When I sent jarfile: something, the Steam Web Helper was internally sending steam://openexternalforpid/10400/jarfile: something. This is huge.
I immediately switched from all these nonsense custom protocols to invoking openexternalforpid with the magic number 10400 and cmd.exe and guess what? Remote. Code. Execution. Job done.
Because this link form isn't a javascript:// link, it's still honoured by Steam Chat. Either I could send my codepen.io embed or I could send my [link] tag to get remote code execution :)
4. Conclusion
This was fun as all hell and I learned a lot. I always look for bugs where a set of simple mistakes of low severity cascade into one huge bug with critical severity and this is the perfect example of that.
The report
The Steam chat client both sends and receives bbcode format chat messages. These map to HTML elements, and notably the [url] bbcode tag is supported for arbitrary URLs. React has strong XSS mitigations but does not mitigate javascript: URI based XSS.
This is rather difficult to exploit as the client transmits sanitised messages and receives over a binary WebSocket. I've attached a video of executing this XSS, which is persistent.
Impact
I strongly believe an attacker could get remote code execution in Steam via this method. The Steam chat client uses the same codebase as the steam web chat client, and, I imagine does so using electron or some other webview system. These systems all expose functions which allow arbitrary calls to system to allow them to be competitive with e.g. windows forms.
Attachments
Context
The target was the Steam Chat client, reachable online at https://steamcommunity.com/chat and shipped inside the Steam desktop application. The researcher noted that the app deployed inside the Steam desktop app was the same as the online one, which made it much easier to inject DevTools into the testing flow.
The client is a React application. It sends and receives BBCode-format chat messages, and those BBCode tags map to HTML elements. Among the supported tags is [url], which accepts arbitrary URLs. The client also supports embedded content through OEMBED, and it runs inside a custom, locked-down build of Chrome Embedded Framework rather than a typical Electron shell. Privileged actions are reached through PostMessage and a loopback WebSocket to the parent process, not through a privileged window object.
The researcher describes the stack as having strong security characteristics: React avoids the dangerously family of functions except where OEMBED requires them, and a Content Security Policy is deployed, although with unsafe-inline.
Setup
No accounts, roles or versions are described. The tools and preconditions that mattered were:
- Chrome DevTools, attached to the chat client. Because the desktop app and the web client share a codebase, the online client could be used for testing.
- The React Chrome Extension, to inspect the DOM and jump from a rendered element to the component that generates it, and to read the
propsa component depends on. - Breakpoints on
dangerously,innerHTML, XHR/fetch and event listeners, plus the call stack to walk back from library code to application code. - A remote Chrome console loaded inside a codepen.io embed, used to run code in the Steam Web Helper context.
- The Steam Console, opened with
steam://console, which printed thesteam://invocations the client was making. - A binary grep over the Steam folder for known Steam protocol URIs, followed by searching string tables in vim, to find undocumented URIs.
Finding it
With the Network panel open, the researcher saw no XHR polling, which suggested a WebSocket. Refreshing with the panel open showed the connection, and its frames were unintelligible binary. The client sanitises messages on the way out and receives them over a binary protocol that is very difficult to dissect over the wire.
Code searches for OEMBED and other embedding systems led to the React app. Searches for dangerously and innerHTML, with breakpoints set on them, showed that dangerously was called only for certain oembed elements that the chat server could send. Breakpoints on the XHRs fired by loading OEMBED content such as YouTube were used to step back through the call stack to the function that sanitised user input and sent it over the binary WebSocket.
That produced an important observation: the breakpoints fired twice per sent message. The first render happens when the user sends, with the client writing an assumed server response to the DOM. The second happens when the real server response overwrites it. The two renders can differ significantly, particularly with OEMBED. Sending a Vimeo link renders an HTML link locally; when the server updates the room, it replaces the link with a BBCode [OEMBED] tag that is essentially raw HTML.
Exploitation
Step 1: probe which BBCode tags survive the server
Using a breakpoint after the sanitisation of user BBCode, the researcher sent OEMBED tags containing malicious HTML, hoping the server would reflect them. The server stripped these tags completely before responding.
A scan of the code located the table mapping BBCode tags to React components, and every tag in it was sent. Most were stripped by the server, and many needed attribute parameters such as [imgur alt=] that the researcher did not know how to use. Logging the BBCode representation of rich text commands such as rolling a random number or showing an image produced little.
A small handful of tags could be sent that would otherwise be stripped: [url=xxx], [code] and [image]. [image] was heavily locked down and could not be used maliciously. [code] safely generated [code] tags. [url=xxx] legitimately made links to anywhere, including javascript: URIs.
Step 2: confirm the XSS and test its reach
The [url=xxx] tag legitimately made links to anywhere, including javascript: URIs. In the custom Steam client browser, however, javascript: URIs were stripped or not honoured. The researcher could form any URL, so the next step was to try other schemes.
Step 3: try steam:// URIs
Based on prior art, the researcher used steam:// URIs, which are unique to the Steam client. In the Chat client these executed in a privileged context that browsers cannot normally reach. Valve had added a confirmation prompt for steam:// URLs opened by an external system, but links in the Steam chat client caused no such confirmation. The researcher experimented with links that opened games, reset configurations, closed Steam, and opened internal systems such as the Steam console. The exact URL used for the console is not given in the report.
Step 4: target OEMBED through a whitelisted embed
Secure OEMBED implementations are hard, so services such as Embedly are commonly used, with security resting on iframe sandboxing and whitelists. The researcher's reasoning was that inside a non-standard browser, being embedded grants different privileges: in an Electron-style app, an iframe that is not a special <WebView> can still reach dangerous APIs through its window object even if it would be safe in a normal browser.
Abusing this required either being whitelisted by Embedly, which the researcher considered impossible, or finding JavaScript injection in a whitelisted embed. codepen.io is whitelisted by Embedly and is, in the researcher's words, JavaScript injection as a service. A codepen.io app carrying a remote console was loaded into Steam.
Step 5: explore the Steam Web Helper context
With the remote console running, the researcher dumped Object.keys(window) and diffed it against a normal Chrome browser. Most differences were useless. Some events could be hooked, such as when styles loaded on the page, but nothing that was a security issue on its own.
Because the Chat client talks to a parent window for privileged operations such as pulling the friends list, the researcher tried window.top.postMessage() with the commands the client used. The sandboxed context produced by the OEMBED system prevented access to window.top.
The remote console was then used to test steam:// URIs quickly by issuing open("steam://xxx"). That did not add much, so the researcher moved to dissecting the Steam Web Helper binary: a binary grep in the Steam folder for known Steam protocol URIs, then vim searches for string tables containing them. This surfaced undocumented URIs specific to the Steam Web Helper.
Step 6: windows opened from the embed
Two URIs stood out: a Chrome Dev Tools URI, and steam://openexternalforpid, which appeared in the binary as:
steam://openexternalforpid/%s/%s
The Dev Tools URI opened a single-pixel-wide black window as many times as it was invoked. openexternalforpid clearly needed two parameters, but their meaning was not obvious. The researcher passed it to a binary reverse-engineer friend, who found it difficult to make much of it with the little time he could spare.
The researcher then considered that opened windows often have different privileges from the opener in embedded browsers, and tried grabbing the window returned by opening the Dev Tools URI, for example open('steam-chrome-dev-tools://something').contentWindow. New windows did have special functions not normally accessible: the cursor position could be read, and the window could be maximised, minimised and manipulated in other ways. None of it led to remote code execution after hours of testing.
Step 7: custom protocols and filetype associations
While testing steam://, the researcher noticed that a typo caused Windows to open a dialog saying it did not know how to open a file type such as sream:. That led to an exploration of how custom protocols are registered on Windows. They live in the registry alongside filetype associations, and the folders for http: sit next to the folders for .png, following the same syntax that turns arguments into a program invocation. Typing .txt:hello into the Run dialog opened Notepad, confirming that custom protocols and filetype associations are the same mechanism.
Among the protocols found were calculator:, which opens the calculator, and two potentially exploitable ones: jarfile:, the binding for the .jar filetype, which executes the jarfile given to it, and JSEFile:, a Windows XP-era system that ran an HTML page with VBScript like a program.
The first attempt failed because the full URI was passed as the argument. A link to jarfile:c:/windows/whatever.exe produced an invocation along the lines of c:/Program Files/Java/Java.exe jarfile:c:/windows/whatever.exe, which looks for a directory called jarfile:c: that does not exist.
The fix was directory traversal. Injecting ../ sequences negated the non-existent directory, so a link such as:
jarfile:..\..\..\..\..\..\..\..\Users\Username\Downloads\drive-by-download.jar
would legitimately run a jar file on the victim's computer. This was exciting and disappointing at once: the jar file could not be loaded remotely, so the user would have to download it first.
Step 8: openexternalforpid with the magic number
Throughout this work the Steam Console had been open and printing the steam:// invocations being run. Tabbing onto it by accident, the researcher saw that sending jarfile: something caused the Steam Web Helper to send internally:
steam://openexternalforpid/10400/jarfile: something
Switching from the custom protocols to invoking openexternalforpid with the number 10400 and cmd.exe gave remote code execution.
Because this link form is not a javascript:// link, Steam Chat still honours it. Either the codepen.io embed or the [link] tag could be used to deliver it.
Root cause
The Steam chat client both sends and receives BBCode chat messages, and those tags map to HTML elements. The [url] tag accepts arbitrary URLs. React has strong XSS mitigations but does not mitigate javascript: URI based XSS, so a [url=javascript:...] tag is enough to execute script in the chat client's context. The report describes the XSS as persistent, and a video of it executing is attached.
From there, the chain relies on the client honouring steam:// links without the confirmation prompt that applies to external systems, and on openexternalforpid accepting a process identifier and a command. The report does not state why 10400 works or what it identifies; it was found by observing the console output when a jarfile: link was sent.
Impact
The researcher states a strong belief that an attacker could get remote code execution in Steam through this method, because the Steam chat client shares a codebase with the web chat client and, in the researcher's view, likely uses Electron or a similar webview system that exposes functions allowing arbitrary system calls. The demonstrated path is a persistent XSS in the chat client that, combined with steam://openexternalforpid/10400/ and cmd.exe, produced remote code execution. The report does not describe the exact command sent or the response observed.
Fix
Variants to test
- Send
[url=javascript:...]in any BBCode-to-HTML chat feature and check whether the link is rendered and honoured. A positive result is script execution when the link is clicked. - Send
[url=steam://...]links and observe whether the client prompts for confirmation. A positive result is a privileged action with no prompt. - Look for
openexternalforpidstyle handlers in the client binary and try to invoke them with a process identifier and a command. A positive result is a process launched on the host. - Test custom protocol handlers that pass the full URI as the first argument, and try
../traversal to escape the bogus directory prefix. A positive result is execution of a local file. - Load a whitelisted embed such as codepen.io and check whether
window.topis reachable or whether opened windows expose extra functions. A positive result is access to privileged APIs from the embed.
Hunting notes
This kind of bug hides where a client renders rich text from a server that echoes user input, especially when the client optimistically renders an assumed response before the real one arrives. The two renders can differ, and the second one may carry tags the first did not. Watching for breakpoints firing twice on a send is a useful signal.
During recon, a binary WebSocket with no XHR polling points to a custom protocol that is hard to intercept, so DevTools breakpoints and call stack walking matter more than an HTTP proxy. Code searches for dangerously, innerHTML and embedding systems such as OEMBED quickly locate the risky render paths.
The impact case rested on chaining the XSS with the client's privileged steam:// handling and on observing the console output to discover the openexternalforpid invocation.
What happened, in plain words
Steam is Valve's store and launcher for games. It also has a chat feature, where you can message friends. That chat exists in two forms: a web page at https://steamcommunity.com/chat, and a window inside the Steam desktop program you install on your computer. Both are built from the same code, which matters a lot here.
Chat messages can contain formatting, written in a simple markup language called BBCode. BBCode uses square brackets, for example [url=...] to make a link. The chat program turns those brackets into real web page elements, such as a clickable link.
A web page element that is a link can point anywhere, including to a special kind of address that starts with javascript:. When a browser follows such an address, it does not open a page: it runs the text after the colon as a program inside the page. That is the classic cross-site scripting (XSS) bug. An attacker who can get a link like that into someone else's chat can run their own code in the victim's chat window.
That alone would be bad but limited. The researcher then found a second weakness. The Steam chat window accepts links that start with steam://, which are commands for the Steam program itself, and it does not ask the user for confirmation the way a normal browser does. The researcher then found a second weakness: the Steam chat window accepts links that start with steam://, which are commands for the Steam program itself, and it does not ask the user for confirmation the way a normal browser does. Through a hidden Steam command, a link could become a command run on the victim's computer. That is remote code execution (RCE): the attacker's code runs on someone else's machine.
The report walks through how the researcher got there: how the chat program is built, which tools were used to look inside it, which message tags survived the server, how the javascript: link was found, why it did not work in the desktop app, how steam:// links behaved, how a whitelisted embedded page (codepen.io) was used as a foothold, and finally how a hidden Steam command called openexternalforpid turned a link into a command run on the machine.
Background: what the chat client is made of
The Steam Chat client is a web application. It is written with React, a popular toolkit for building web pages out of reusable pieces called components. React is generally good for security because it escapes text before putting it on the page, so ordinary user text cannot become code. The researcher notes that the app avoids React's dangerously family of functions, which are the escape hatches that let a developer insert raw HTML. It uses them only where embedded content requires it.
The app also uses a Content Security Policy (CSP). A CSP is a set of rules a website sends to the browser saying which sources of code and content are allowed. It is a safety net against injected code. Here the policy includes unsafe-inline, which weakens it: it allows code written directly into the page, which is exactly what an injection would produce. The researcher calls this a minor inconvenience.
The desktop version does not run in a normal browser, nor in a typical Electron shell. Electron is a common way to build desktop apps with web technology; in many Electron apps the page gets powerful access to the operating system through the window object. Steam instead runs the chat in a custom, locked-down build of Chrome Embedded Framework (CEF, the browser engine embedded in other programs). The page behaves like a normal web page. When it needs something privileged, such as the friends list, it asks the parent process through PostMessage (a way for windows to send messages to each other) and a loopback WebSocket. A WebSocket is a two-way connection between a browser and a server that stays open; loopback means it stays on the same machine. The messages on that connection use a custom binary format, which is hard to read or tamper with from outside.
The researcher also mentions a practical annoyance: Chrome DevTools sometimes crashes if breakpoints fire while the page loads, which he suspects is a race condition involving WebWorkers (background scripts) and heavy JavaScript files.
Why this matters: the researcher is interested in apps that build their pages in the browser (DOM-heavy apps), because many security testers rely on HTTP proxies, tools that sit between browser and server and record requests. Those tools cannot see what a page looks like after the browser has assembled it, so they miss a lot.
Techniques: where React apps can still be attacked
React removes many classic XSS routes, so the researcher lists the ones that remain.
- Attributes are not specially encoded. React does not treat every attribute as dangerous, but some attributes can run code. A link's
hrefis the obvious one: if it is built from user input, ajavascript:address will run when clicked. Hand-written filters forjavascript:are often weak, and URL parsers used for this job were not designed to be safe against attackers. - Style attributes built by joining strings. If user input ends up in a
styleattribute, an attacker can inject CSS. CSS is the language that styles web pages, and it can load images from other servers. That can leak information, for example by making the browser request a URL that contains data from the page. The researcher notes that CSS sanitisation is basically not a solved problem, even in good libraries. - Other unsafe JavaScript features are untouched. React does not make
document.location = ...safe. Setting the page location from user input is another way to inject ajavascript:address. Nor does React make API requests safe: if user input is pasted into a URL path without proper encoding, an attacker can change the path. The researcher points out that there is, to his knowledge, no safe way to encode a URL path in plain JavaScript, because servers treat%2Fand/as the same thing. - Some protocols return HTML by design. OEMBED is a standard that lets a site embed content from another site, such as a video. Some OEMBED services return HTML, so a React app has to use
dangerouslySetInnerHTMLto display it. That is the raw-HTML escape hatch. Sometimes developers also grab the generated element and setinnerHTMLdirectly, which a simple search for the worddangerouslywill not find. And even services that do not return HTML often sendContent-Type: text/html, which means a browser that is sent straight to such a response will treat it as a web page.
Techniques: DevTools features that helped
The researcher lists the browser developer tools (DevTools) features he used. DevTools is the panel built into Chrome (and similar browsers) that lets you inspect a page, its code and its network traffic.
The Console Drawer
Press Escape with DevTools open and a drawer slides up from the bottom. It gives you powerful tools while you are still looking at source code or network logs. The most useful is the console inside the drawer: when the debugger has paused the page at a breakpoint, code typed there runs in the context of the paused line. That lets you inspect and change values at any level of the program.
Code Search and Pretty Print
DevTools can search every file loaded into the current window. You open it from the bottom drawer (the three dots). If you see an element on the page and wonder which code made it, you search for it and jump to the place it is mentioned. Then you press the pretty print button {} in the bottom left, which reformats minified code (code squashed onto few lines to save space) into readable lines, and use Ctrl+F to find what you need.
Breaking on Events
Often you know an event happens, such as a network request (XHR) or a PostMessage, but not where its handler is defined. At the bottom of the right-hand panel of the Sources tab you can set breakpoints for XHR/fetch requests and for event listeners. A breakpoint is a marker that tells the debugger to pause the program at that point.
The Call Stack
When a breakpoint fires, the Sources panel shows the call stack on the right: the chain of function calls that led to this point. You can click each entry to step back up the chain, viewing the code, the variables and the file at each level. This is how you escape from deep inside a library to the code written specifically for the app.
Injecting Code
DevTools can edit JavaScript on the fly, but not in minified files, and not in pretty-printed views. A trick gets around this: right-click a line number and choose to insert a conditional breakpoint. A conditional breakpoint is a small piece of JavaScript that pauses the program only when it evaluates to true. Because console.log always returns undefined, you can put console.log calls in a conditional breakpoint to print values as the program runs without stopping it. This is more effective than the watch feature. It also helps in apps with a heartbeat (a regular signal between client and server): a normal breakpoint can cause a disconnection, while a conditional one does not stop execution.
Network Search
If data arrives from somewhere and you do not know where, click the magnifying glass in the Network panel to search full requests, responses and headers.
Network Filter Expressions
Apps that poll the server constantly flood the Network panel. Filter expressions narrow the list to the requests you care about.
Copy as Curl
DevTools cannot bypass browser security rules such as the same-origin policy (the rule that one site's code cannot read another site's data). But you can right-click any request in the Network panel and choose copy as curl. Curl is a command-line tool for making web requests. The copied command reproduces the request exactly, and you can edit it and run it again and again.
Approach: where to look first
In an older style of chat app, the likely place for a bug is where the app turns message text into HTML. Parsing text is hard, and giving users the power of HTML without letting them control the browser is harder.
Recon
The first useful observation: the chat inside the Steam desktop app is the same as the web version at https://steamcommunity.com/chat. That meant the researcher could test in a normal browser with DevTools attached.
With the Network panel open, he watched the chat for a while. There was no constant stream of XHR requests (the usual way a web page fetches data in the background). That suggested a WebSocket. WebSocket connections only appear in the Network panel if the panel is open when the connection is made, so he refreshed the page and looked at the WS tab. The frames were completely unreadable binary.
The chat supports embedded content, which is very hard to make secure. So he searched the code for OEMBED and other embedding systems, which are common sources of XSS.
That is when he realised the app is React. He switched, at least partly, to the React Chrome Extension, a browser add-on that shows the React component tree. It lets you jump from an element on the page to the code that generated it, and read the props (the inputs a component receives). That made the app's structure much easier to follow.
He searched for dangerously and innerHTML and set breakpoints on them. Then he tried to make those functions run, and walked up the call stack each time. dangerously was only called for certain oembed elements that the chat server could send. He set breakpoints on the requests fired when OEMBED content such as a YouTube video loaded. When they fired, he stepped back through the call stack until he reached the function that sanitised user input and sent it to the chat servers over the binary WebSocket.
Reaching XSS
The breakpoints revealed something surprising. They fired twice for each message sent. The first time was when the user pressed send: the client wrote an assumed server response into the page straight away, so the message appears instantly. The second time was when the real response arrived from the server and replaced it. The two versions can differ a lot, especially with OEMBED.
For example, send a Vimeo link. The client first shows it as an ordinary HTML link. Then, when the server updates the chat room, it replaces the link with a BBCode [OEMBED] tag, which is essentially raw HTML.
The researcher tried to exploit this. Using a breakpoint after the sanitisation of user BBCode, he sent OEMBED tags containing malicious HTML, hoping the server would send them back. The server stripped them completely.
He then found, in the code, the table that maps BBCode tags to React components, and sent every tag in it. Most were stripped by the server. Many needed attribute parameters such as [imgur alt=], which he did not know how to use. He also tried logging the BBCode form of rich text commands such as rolling a random number or showing an image, with little success.
A few tags got through: [url=xxx], [code] and [image]. [image] was heavily locked down and could not be abused. [code] just produced safe [code] tags. But [url=xxx] made real links to anywhere, including javascript: addresses.
He opened the report at that point, saying he had reached XSS, which in such clients often leads to RCE. It turned out to be more complicated.
The XSS was real, and he could mess with web browser users. But in the custom Steam client browser, javascript: addresses were stripped or simply not followed. Since he could form any URL, he started trying other kinds of address.
The Steam URI
He began with steam:// addresses, which only the Steam program understands and which can do a lot of damage. Years earlier, steam:// links in browsers had been used to reach RCE by installing a game and piping its logs into the startup folder.
He had some success. In the chat client, steam:// addresses ran in a privileged context that a normal browser cannot reach. After the earlier problems, Valve had added a confirmation prompt when a steam:// address is opened by an external system: if you send someone steam://open/440 in a web browser, Steam asks whether they really want to open that game. Links in the Steam chat client caused no such prompt.
He experimented with links that opened games on people's computers, reset their configurations, closed Steam, or opened internal systems such as the Steam console. He does not remember the exact address for the console.
Abusing OEMBED
He changed tack and targeted OEMBED directly. Secure OEMBED is hard to build, so sites usually use a service such as Embedly. Embedly's security comes from sandboxing iframes (a sandbox is a restricted box for embedded content) and from whitelists (lists of approved sites). But inside a non-standard browser, being embedded gives different privileges. In an Electron-style app, an iframe that is not a special <WebView> can still reach dangerous Electron APIs through its window object, even if it would be safe in a normal browser.
To abuse that, he needed either to be whitelisted by Embedly (which he considered impossible) or to find JavaScript injection in a site that is already whitelisted. codepen.io is whitelisted by Embedly, and codepen is, in his words, JavaScript injection as a service: it is a site for writing and running code. He loaded a codepen.io app carrying a remote console into Steam. A friend had recommended using a remote chrome console.
Remote Console
With the remote console running inside Steam, he looked for oddities in the Steam Web Helper context (the browser process that renders the chat). He dumped Object.keys(window), which lists the names of everything attached to the page's global window object, and compared it with a normal Chrome browser. Most differences were useless. He could hook events such as when styles loaded on the page, but nothing that was a security issue by itself.
The chat client talks to a parent window for privileged actions such as pulling the friends list. So he tried window.top.postMessage() with the commands the client used, hoping to make it do something bad. The sandbox around the OEMBED content blocked access to window.top (the outermost window).
He then used the remote console to test steam:// addresses quickly by calling open("steam://xxx"). That did not add much, so he started dissecting the Steam Web Helper binary. A binary is a compiled program; you cannot read it like source code, but you can search it for text. He ran a binary grep (a search for text inside a binary file) in the Steam folder for Steam protocol addresses he knew existed, then used vim (a text editor) to search string tables containing them. That led him to undocumented addresses specific to the Steam Web Helper.
Through an Open Window
Two addresses stood out. One was a Chrome DevTools address that he hoped might carry some privilege. The other was steam://openexternalforpid, which appeared in the binary as:
steam://openexternalforpid/%s/%s
This is a template. %s is a placeholder for a piece of text that gets filled in at runtime, so the address takes two parameters. The DevTools address did strange things: opening it produced a single-pixel-wide black window, as many times as he invoked it. The openexternalforpid address clearly needed two parameters, but he had no idea what they were.
He passed the problem to a friend who is a skilled binary reverse-engineer (someone who works out what a compiled program does). The friend found it hard to make progress in the time he had.
Then the researcher had an idea about the context in which this JavaScript ran. In embedded browsers, opening a window is often handled specially, and an opened window often has different privileges from the window that opened it. He tried grabbing the window returned by opening the DevTools address, for example open('steam-chrome-dev-tools://something').contentWindow. The new windows did have special functions that are not normally available: he could read where the user's cursor was, maximise or minimise the window, and do other things. After hours of testing, none of it led to RCE.
Beyond Protocol
While testing steam://, he noticed something. Whenever he made a typo, Windows opened a dialog saying it did not know how to open a file type such as sream:. That was interesting.
Custom protocols such as Steam are implemented by many different programs. They are usually badly built, and their security depends on the browser asking the user before opening the program. Years ago, when everyone used Skype, he had fun sending people skype://call links, which opened calls to a loopback Skype number that just echoes what you say.
But people do not use Skype much now, so he wondered what other custom protocols were registered on his system. This led him deep into Windows internals. He spent hours reading forums and reference documents about how protocols are added and which ones Windows registers. There are quite a few. Windows even has protocols for opening maps to places for the user to look at.
Then he went deeper. Custom protocols are registered in the Windows Registry, in a location he remembers as HKEY_CURRENT_CLASSES or something similar. The Registry is a central database of settings in Windows. The structure is revealing: it holds every protocol (including what opens when you click an http:// link) and also the file type associations for every file type, such as Notepad opening a .txt file. The folders for http: sit right next to the folders for .png, and they use the same syntax, which describes how arguments become a program invocation. In disbelief, he pressed Win+R (the Run dialog) and typed .txt:hello, and Notepad opened. Custom protocols and file type associations are the same mechanism.
After that, he searched the whole class for anything useful, getting smarter each time. He went straight for the .bat file type, which runs arbitrary Windows commands, and tried it in Run. It crashed Windows Explorer.
He got smarter and looked for file types that take the first argument and open it with a program. From reading how protocols open, it was clear that if the first argument is called $0, a protocol such as http:// is essentially open_webbrowser.exe $0, where $0 is the URL.
He found some bizarre things. There is a calculator protocol. He does not know why, but there is. If you want to be fancy and show a calculator popping up, you can literally make a link like <a href="calculator:">click me!</a>, and clicking it opens the calculator on the victim's computer.
He spent hours trawling this database and found a few potentially exploitable protocols. One is jarfile:, which executes the jar file you give it; it is the binding for the .jar file type. Another, JSEFile:, is a Windows XP-era system that ran an HTML page with VBScript like a program, like a prehistoric Electron.
It did not work. The problem was that $0 included the full URI. A link to jarfile:c:/windows/whatever.exe produced an invocation along the lines of c:/Program Files/Java/Java.exe jarfile:c:/windows/whatever.exe, which tries to find a directory called jarfile:c: that does not exist.
He took a break and submitted another ticket, saying he had found another interesting method and could open any program on the victim's computer, though not with the arguments he wanted. He was sure this was a route to RCE. At the very least he could submit an example that launched calculator.exe, which is what all the cool kids do.
Then he had an epiphany: directory traversal. If the program is looking for a directory called jarfile:c: that does not exist, you can inject ../ to mean go one directory back, cancelling out the bogus directory. This worked. A link such as:
jarfile:..\..\..\..\..\..\..\..\Users\Username\Downloads\drive-by-download.jar
would legitimately run a jar file on the victim's computer. This was exciting and disappointing at once: the jar file could not be loaded remotely, so the user would have to download it first.
openexternalforpid
All this time, the Steam Console had been open (opened with steam://console, he thinks). He was not reading it, but it was printing useful information, in particular which steam:// invocations were being run. He tabbed onto it by accident and, by sheer luck, saw something. When he sent jarfile: something, the Steam Web Helper was internally sending:
steam://openexternalforpid/10400/jarfile: something
This was huge. He switched from the custom protocols to invoking openexternalforpid with the number 10400 and cmd.exe, and got remote code execution.
Because this link form is not a javascript:// link, Steam Chat still honours it. He could deliver it either through the codepen.io embed or through the [link] tag.
Conclusion
The researcher says this was fun and that he learned a lot. He looks for bugs where a set of simple, low-severity mistakes cascade into one huge bug, and calls this a perfect example.
The report
The Steam chat client both sends and receives BBCode chat messages. Those tags map to HTML elements, and the [url] tag accepts arbitrary URLs. React has strong XSS mitigations but does not mitigate javascript: URI based XSS.
This is hard to exploit because the client sends sanitised messages and receives over a binary WebSocket. He attached a video of the XSS executing, which is persistent.
Impact
He strongly believes an attacker could get RCE in Steam this way. The Steam chat client uses the same codebase as the Steam web chat client and, he imagines, runs it using Electron or some other webview system. Those systems all expose functions that allow arbitrary calls to the system, so that they can compete with desktop toolkits such as Windows Forms.
Glossary
- API: a defined way for one piece of software to ask another for something, like a menu of requests a program accepts.
- BBCode: a simple markup language using square brackets, such as
[url=...], used to format forum and chat messages. - Binary: data made of raw bytes rather than readable text.
- Binary grep: a search for text inside a compiled program file.
- Breakpoint: a marker that tells a debugger to pause a program at a chosen point so you can inspect it.
- Call stack: the list of function calls that led to the current point in a program.
- CEF (Chrome Embedded Framework): the browser engine from Chrome, packaged so other programs can embed a browser inside themselves.
- Chrome DevTools: the inspection panel built into Chrome and similar browsers, showing a page's code, network traffic and more.
- Conditional breakpoint: a breakpoint that pauses only when a small piece of code evaluates to true.
- Content Security Policy (CSP): rules a website sends to the browser saying which sources of code and content are allowed.
- Cross-site scripting (XSS): a bug where an attacker gets their own code to run inside someone else's web page.
- CSS: the language that styles web pages, controlling colours, layout and images.
- Curl: a command-line tool for making web requests.
- Directory traversal: using
../in a path to climb out of the intended folder and reach other files. - DOM: the browser's in-memory model of the page, made of elements such as links and images.
- Electron: a framework for building desktop apps with web technology, where the page often gets powerful access to the operating system.
- Embedly: a service that provides safe embeds of content from other sites, using sandboxing and whitelists.
- File type association: the Windows setting that decides which program opens which kind of file.
- Heartbeat: a regular signal between client and server that shows the connection is alive.
- HTML: the language web pages are written in, made of elements such as links and images.
- HTTP proxy: a tool that sits between browser and server and records the requests and responses.
- Iframe: a box inside a web page that shows another web page.
- innerHTML: a JavaScript property that sets the raw HTML inside an element.
- JavaScript: the programming language that runs in web pages.
- Jar file: a packaged Java program.
- Loopback: network traffic that stays on the same machine instead of going out to the internet.
- Minified code: code squashed onto few lines to save space, which is hard to read.
- OEMBED: a standard that lets a site embed content from another site, such as a video.
- PostMessage: a way for windows and frames to send messages to each other.
- Pretty print: reformatting minified code into readable lines.
- Props: the inputs a React component receives.
- React: a popular toolkit for building web pages out of reusable components.
- React Chrome Extension: a browser add-on that shows the React component tree of a page.
- Registry: the central database of settings in Windows.
- Remote code execution (RCE): a bug where an attacker can run their own commands on someone else's computer.
- Reverse-engineer: to work out what a compiled program does without its source code.
- Same-origin policy: the browser rule that one site's code cannot read another site's data.
- Sandbox: a restricted box that limits what embedded content can do.
- Sanitise: to clean input so that dangerous parts are removed.
- Steam Web Helper: the browser process inside Steam that renders its web pages.
- String table: a list of text strings stored inside a compiled program.
- VBScript: an old Microsoft scripting language.
- WebSocket: a two-way connection between a browser and a server that stays open.
- WebWorker: a background script that runs alongside a web page.
- Whitelist: a list of approved items, here approved sites for embedding.
- XHR: a background request a web page makes to a server without reloading.
windowobject: the global object in a browser page that holds the page's functions and data.