All Projects → doyensec → Electronegativity

doyensec / Electronegativity

Licence: apache-2.0
Electronegativity is a tool to identify misconfigurations and security anti-patterns in Electron applications.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Electronegativity

Log
Time-tracker
Stars: ✭ 316 (-41.48%)
Mutual labels:  electron-app
Keep
Desktop app for Google Keep packaged with Electron
Stars: ✭ 362 (-32.96%)
Mutual labels:  electron-app
Electron With Express
A simple app that demonstrates spawning an Express app from Electron
Stars: ✭ 454 (-15.93%)
Mutual labels:  electron-app
Gmail Desktop
📮 Nifty Gmail desktop app for macOS, Linux & Windows
Stars: ✭ 317 (-41.3%)
Mutual labels:  electron-app
Super Productivity
To-do list & time tracker for programmers and other digital workers with Jira, Github, and Gitlab integration
Stars: ✭ 4,505 (+734.26%)
Mutual labels:  electron-app
Photon
Clone native desktop UI's like cocoa and develop native feeling applications using web technologies
Stars: ✭ 369 (-31.67%)
Mutual labels:  electron-app
Surfbird
A Microblogging client built on Electron and Vue
Stars: ✭ 309 (-42.78%)
Mutual labels:  electron-app
Douyin
抖音 非官方(Web / WIndows / Mac OS)
Stars: ✭ 537 (-0.56%)
Mutual labels:  electron-app
Minta
✳️  Electron app for generating regular expressions
Stars: ✭ 353 (-34.63%)
Mutual labels:  electron-app
Sieve
Sieve Script Editor
Stars: ✭ 452 (-16.3%)
Mutual labels:  electron-app
Issues
Caret issues
Stars: ✭ 326 (-39.63%)
Mutual labels:  electron-app
Glee
也是个网易云第三方😶
Stars: ✭ 345 (-36.11%)
Mutual labels:  electron-app
Crypto Bar
📈 A menu bar app that updates cryptocurrencies prices in real-time
Stars: ✭ 379 (-29.81%)
Mutual labels:  electron-app
Pennywise
Cross-platform application to open any website or media in a floating window
Stars: ✭ 3,382 (+526.3%)
Mutual labels:  electron-app
Debugtron
Debug in-production Electron based app
Stars: ✭ 480 (-11.11%)
Mutual labels:  electron-app
Electron React Webpack Boilerplate
Minimal Electron, React, PostCSS and Webpack boilerplate to help you get started with building your next app.
Stars: ✭ 312 (-42.22%)
Mutual labels:  electron-app
Sqlectron Gui
A simple and lightweight SQL client desktop with cross database and platform support.
Stars: ✭ 3,852 (+613.33%)
Mutual labels:  electron-app
Dynamodb Gui Client
DynamoDb GUI Client
Stars: ✭ 540 (+0%)
Mutual labels:  electron-app
Twinkle Tray
Easily manage the brightness of your monitors in Windows from the system tray
Stars: ✭ 496 (-8.15%)
Mutual labels:  electron-app
Wnr
⏱️ It's a time-management tool for computers. Work and rest, with wnr now.
Stars: ✭ 385 (-28.7%)
Mutual labels:  electron-app

Electronegativity

What's Electronegativity?

Electronegativity is a tool to identify misconfigurations and security anti-patterns in Electron-based applications.

It leverages AST and DOM parsing to look for security-relevant configurations, as described in the "Electron Security Checklist - A Guide for Developers and Auditors" whitepaper.

Software developers and security auditors can use this tool to detect and mitigate potential weaknesses and implementation bugs when developing applications using Electron. A good understanding of Electron (in)security is still required when using Electronegativity, as some of the potential issues detected by the tool require manual investigation.

If you're interested in Electron Security, have a look at our BlackHat 2017 research Electronegativity - A Study of Electron Security and keep an eye on the Doyensec's blog.

Electronegativity Demo

Installation

Major releases are pushed to NPM and can be simply installed using:

$ npm install @doyensec/electronegativity -g

Usage

CLI

$ electronegativity -h
Option Description
-V output the version number
-i, --input input (directory, .js, .html, .asar)
-l, --checks only run the specified checks, passed in csv format
-x, --exclude-checks skip the specified checks list, passed in csv format
-s, --severity only return findings with the specified level of severity or above
-c, --confidence only return findings with the specified level of confidence or above
-o, --output <filename[.csv or .sarif]> save the results to a file in csv or sarif format
-r, --relative show relative path for files
-v, --verbose show the description for the findings, defaults to true
-u, --upgrade run Electron upgrade checks, eg -u 7..8 to check upgrade from Electron 7 to 8
-e, --electron-version assume the set Electron version, overriding the detected one, eg -e 7.0.0 to treat as using Electron 7
-p, --parser-plugins specify additional parser plugins to use separated by commas, e.g. -p optionalChaining
-h, --help output usage information

Using electronegativity to look for issues in a directory containing an Electron app:

$ electronegativity -i /path/to/electron/app

Using electronegativity to look for issues in an asar archive and saving the results in a csv file:

$ electronegativity -i /path/to/asar/archive -o result.csv

Using electronegativity when upgrading from one version of Electron to another to find breaking changes:

$ electronegativity -i /path/to/electron/app -v -u 7..8

Note: if you're running into the Fatal Error "JavaScript heap out of memory", you can run node using node --max-old-space-size=4096 electronegativity -i /path/to/asar/archive -o result.csv

Ignoring Lines or Files

Electronegativity lets you disable individual checks using eng-disable comments. For example, if you want a specific check to ignore a line of code, you can disable it as follows:

const res = eval(safeVariable); /* eng-disable DANGEROUS_FUNCTIONS_JS_CHECK */
<webview src="https://doyensec.com/" enableblinkfeatures="DangerousFeature"></webview> <!-- eng-disable BLINK_FEATURES_HTML_CHECK -->

Any eng-disable inline comment (// eng-disable, /* eng-disable */, <!-- eng-disable -->) will disable the specified check for just that line. It is also possible to provide multiple check names using both their snake case IDs (DANGEROUS_FUNCTIONS_JS_CHECK) or their construct names (dangerousFunctionsJSCheck):

shell.openExternal(eval(safeVar)); /* eng-disable OPEN_EXTERNAL_JS_CHECK DANGEROUS_FUNCTIONS_JS_CHECK */

If you put an eng-disable directive before any code at the top of a .js or .html file, that will disable the passed checks for the entire file. Global Checks can't be disabled using code annotations, since they work on the first pass of Atomic Checks (i.e. making decisions over these). Use -x to disable Global Checks instead.

CI/CD

Electronegativity Action may run as part of your GitHub CI/CD pipeline to get "Code scanning alerts":

Code scanning alerts

Programmatically

You can also use electronegativity programmatically, using similar options as for the CLI:

const run = require('@doyensec/electronegativity')
// or: import run from '@doyensec/electronegativity';

run({
  // input (directory, .js, .html, .asar)
  input: '/path/to/electron/app',
  // save the results to a file in csv or sarif format (optional)
  output: '/path/for/output/file',
  // true to save output as sarif, false to save as csv (optional)
  isSarif: false,
  // only run the specified checks (optional)
  customScan: ['dangerousfunctionsjscheck', 'remotemodulejscheck'],
  // only return findings with the specified level of severity or above (optional)
  severitySet: 'high',
  // only return findings with the specified level of confidence or above (optional)
  confidenceSet: 'certain',
  // show relative path for files (optional)
  isRelative: false,
  // run Electron upgrade checks, eg -u 7..8 to check upgrade from Electron 7 to 8 (optional)
  electronUpgrade: '7..8',
  // assume the set Electron version, overriding the detected one
  electronVersion: '5.0.0',
  // use additional parser plugins
  parserPlugins: ['optionalChaining']
})
    .then(result => console.log(result))
    .catch(err => console.error(err));

The result contains the number of global and atomic checks, any errors encountered while parsing and an array of the issues found, like this:

{
  globalChecks: 6,
  atomicChecks: 36,
  errors: [
    {
      file: 'ts/main/main.ts',
      sample: 'shell.openExternal(url);',
      location: { line: 328, column: 4 },
      id: 'OPEN_EXTERNAL_JS_CHECK',
      description: 'Review the use of openExternal',
      properties: undefined,
      severity: { value: 2, name: 'MEDIUM', format: [Function: format] },
      confidence: { value: 0, name: 'TENTATIVE', format: [Function: format] },
      manualReview: true,
      shortenedURL: 'https://git.io/JeuMC'
    },
    {
      file: 'ts/main/main.ts',
      sample: 'const popup = new BrowserWindow(options);',
      location: { line: 340, column: 18 },
      id: 'CONTEXT_ISOLATION_JS_CHECK',
      description: 'Review the use of the contextIsolation option',
      properties: undefined,
      severity: { value: 3, name: 'HIGH', format: [Function: format] },
      confidence: { value: 1, name: 'FIRM', format: [Function: format] },
      manualReview: false,
      shortenedURL: 'https://git.io/Jeu1p'
    }
  ]
}

Contributing

If you're thinking about contributing to this project, please take a look at our CONTRIBUTING.md.

Credits

Electronegativity was made possible thanks to the work of many contributors.

This project has been sponsored by Doyensec LLC.

alt text

Engage us to break your Electron.js application!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].