Code Monkey home page Code Monkey logo

poshlnkscriptexploit's Introduction

PoSh LNK Script Exploit

Created by: Brad Voris
GitHub GitHub commit activity GitHub All Releases GitHub repo size GitHub language count GitHub issues GitHub top language

This isn't new and is continued to be leveraged by threat actors across the globe.
I'll demonstrate why LNK files should be blocked at the email level and if embedded in other files should be blocked by default.

We'll take a single line from an LNK file that executes PowerShell:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe

We will add the following:
-NoExit
-NoExit Prevents the window from exiting once the commands have been run

-c
-c executes commands directly following the -c

Now we can add ANY powerShell that can fit in the 255 character limit.

In my sample code we count down from 1 to 5 writing dots to the screen on a single line and waiting a second inbetween them. When the command ends it writes to the host Formatting C Drive Complete!... (Some bad humor on my part.)

%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit -c 1..5 | foreach { write-host "." -NoNewline; sleep -sec 1} -end {write-host "Formatting C Drive Complete!" }

Considering the 255 character limit its very easy to see how threat actors can use LNK files to auto-download a payload and execute. This is especially true with URL shorteners.

Inspiration for this project:
https://thehackernews.com/2023/05/north-koreas-scarcruft-deploys-rokrat.html?m=1
https://www.mcafee.com/blogs/other-blogs/mcafee-labs/rise-of-lnk-shortcut-files-malware/

Connect with me at





Victim Of Technology

Cyber Forge Security, Inc.

poshlnkscriptexploit's People

Contributors

bvoris avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

stefanaustin

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.