Johannes S.
Johannes S.

Reputation: 431

How to display version of Electron environment in an Electron app?

I would like to find out which version of Electron an Electron desktop app like Signal Desktop or Visual Studio Code is using. Is there a simple way - like entering a command in the Development Console?

Thanks! Johannes

(Why? I would like to see if it is affected by bugs like https://www.trustwave.com/Resources/SpiderLabs-Blog/CVE-2018-1000136---Electron-nodeIntegration-Bypass/)

Upvotes: 38

Views: 58233

Answers (3)

linxie
linxie

Reputation: 2167

You can, if the App enabled developer tools and enabled nodeIntegration. Take VS Code as an example:

open the Developer Tools, in the console tab, type

process.versions.electron

documentation here: https://electronjs.org/docs/api/process

or try parsing version from userAgent string

navigator.userAgent.match(/Electron\/([\d\.]+\d+)/)[1]

enter image description here

Upvotes: 48

Wyatt Ward
Wyatt Ward

Reputation: 1169

Under a Unix-like or Linux system (and possibly under Windows using Cygwin or MSYS shells or WSL, but this is untested there), you can use the strings program even for progams that are built without the developer tools enabled.

Basically, you're just searching for a user-agent string in the binary itself.

Currently, I have been able to do the following:

$ strings example-electron-app-binary-file | grep '^Chrome/[0-9.]* Electron/[0-9]'
Chrome/98.0.4758.141 Electron/17.4.7

That regular expression searches for strings starting with Chrome/, followed by any number of numerical digit and dot characters, a single space, and then Electron/ with any numerical digit after it.

This won't work in all likelihood if your system uses UTF-16 strings, but since browsers tend to use UTF-8 internally there's still a chance it'd work on a Windows electron binary.

Upvotes: 10

gib
gib

Reputation: 788

Open the Developer tools and in the Console tab type:

navigator.userAgent

For example in the Discord app I'm getting:

Mozilla/5.0 ... Electron/9.3.5 ...

Upvotes: 17

Related Questions