Git Product home page Git Product logo

bad_actor_poc's Introduction

TL;DR

Open innocent_app in VSCode*, and the contents of your .ssh/id_rsa file will be sent over TCP to localhost:8080. You don't even need to open any files in the project!

*This assumes you have the rust toolchain available on your machine, and the rust-analyzer VSCode plugin.

Or watch the video example.

Exfiltrating secrets with Rust macros

This is a proof-of-concept of exfiltrating secrets from a developer's machine. Originally, the target was exfiltrate at compile-time, but it became apparent it was possible even before that step, i.e. during pre-processing.

How it works

When innocent_app is opened in VSCode, the editor runs enough of the Rust toolchain to expand the nefarious make_answer! macro, which opens .ssh/id_rsa and sends its contents to localhost:8080.

Run it yourself

  • Clone this repo: git clone https://github.com/lucky/bad_actor_poc.git
  • Listen on port 8080 locally, for example with nc -lk 8080
  • Open up the innocent_app in VSCode with rust-analyzer plugin

Once open, VSCode will analyze and index the code, including the expansion of macros, then you should see the contents of your .ssh/id_rsa private key in the nc window.

You can trigger the same behavior at compile-time by running cargo build in the innocent_app directory.

Notes

This may affect other editors. VSCode and rust-analyzer were used to confirm the attack vector, but are not exactly responsible for them. Any editor that expands a proc macro can do this.

There may be similar attacks for other languages. For example, it may be possible to attack Java annotation processing.

bad_actor_poc's People

Contributors

lucky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.