Skip to main content

Hack VBA Password

A few days ago, I had to pull out one of my old tricks to hack into a password protected VBA module. The file I was working on was protected by a former (evil) employee who, for some reason, did not leave the VBA password.

.

I’m notoriously lazy, so there is no way I’m retyping code that’s already there. I’d rather hack into the workbook.
.

Today, I’ll walk you through the steps I use to crack VBA passwords. I learned this trick a while back from one of my Excel Boot Camp students. I can’t remember who. Sorry…whoever you are. Even though I can’t remember your name, I value our friendship greatly.
.

Step 1: Download a Hex Editor

You’ll need a Hex Editor. I use one called XVI32. Why this one? Because it’s the one my mysterious friend showed me. I’m not really into Hex Editors, so I couldn’t tell you if it’s good or bad. I just know it does the trick. Download the XVI32 Hex Editor and have it ready to go.
.

Step 2: Save your Workbook as XLS and MAKE A BACKUP COPY

If you’re working with an XLSM file, you’ll need to save it as an XLS. Be sure you make a backup of your workbook before you start. Because you’re diddling the insides of the workbook, there is always a chance you could royally screw up. You’ll want a backup.
.

Step 3: Open Your Workbook in the Hex Editor

Fire up the Hex Editor you downloaded and then (within the editor) select and open your workbook. In the XVI32 editor, my workbook looks like this:

.

Step 4: Find and Replace the DPB Keyword

In your Hex Editor, look for the text string DPB.

.

This text string apparently indicates Excel’s tag for the VBA Password.


..

In order to confuse Excel and get around the VBA Password prompt, you just need to muddle the tag a little. You can do this by simply changing the DPB to something like DPX (replace the B with an X).


..

Step 5: Save Your Changes

Close the Hex Editor and be sure to save your changes


Step 6: Open your Newly Diddled Workbook

Open the workbook you just finished molesting. You will get a few messages.
First this one, which you will say Yes to:



.

Then you’ll see this one (a few times). Don’t panic, and keep clicking OK.


Step 7: Remove the VBA Protection

When Excel stops its bitching and moaning, go to the Visual Basic Editor (Alt+F11) and then select View>>Project Explorer.
Right click on the VBAProject for your workbook and select VBAProject Properties.

In the Properties dialog box, go to the Protection tab and clear any selections and text you see there.

Step 8: Save a Close your Newly Unprotected Workbook.

Save and close the workbook. At this point, you’ll have full reign over the VBA in the workbook.
.

There you have it – another trick for your toolkit.
I could suggest that you use this trick only for good and righteous purposes, but you won’t listen anyway.

Comments

Popular posts from this blog

FPDF dengan CodeIgniter

Cetak Surat Keputusan Controller: <?php //File in controller named surat_keputusan.php defined('BASEPATH') OR exit('No direct script access allowed'); class Cetak_surat_keputusan extends CI_Controller { public function __construct()     {         parent::__construct();         $this->load->helper('url');         $this->load->database();                $this->db->select();         $this->db->from('surat.config_sk');                $query = $this->db->get();                 return $query->result();             } public function index() {         if(isset($_GET['id_sk'])){                     date_default_timezone_set('Asia/Jakarta');                         $query=$this->load->database('surat',TRUE)->get_where('config_sk',array('id_sk'=>$_GET['id_sk']));             $data_sk=array(                 'id_sk'=>'',                 'sk_nomo

Hack File .xlsb

For first you must create a backup copy of your Workbook!!! Then you have to rename the XLSB file with ZIP extension. Test.XLSB => Test.ZIP             Opening your ZIP file using a compression software (e.g. WinRar) I can see the content of the file, structured in folders Inside the folder xl you can find a binary file named vbaProject.bin. Extract it on your desktop and edit it using a text editor. In my case I used Notepad++. Using the Find function of your editor, you must search the text DPB And replace the DPB string with DPx Then save the vbaProject.bin and replace this file inside the .ZIP File, renaming then .ZIP file in XLSB. Reopening the XLSB file using Excel, you will get an error message: you have to answer Yes to this error message. Then  Save , Close and Reopen your XLSB file. Now, if you go to VBA Editor (ALT + F11), you can see and edit all project files. B. And FIle

Preview PDF di Modal Bootstrap dengan Ajax

//preview pdf in line function preview_surat_keputusan(no) { $('#form')[0].reset(); $('.form-group').removeClass('has-error'); $('.help-block').empty(); $.ajax({ url : "<?php echo site_url('surat_keputusan/ajax_preview/')?>/" + no, type: "GET", dataType: "JSON",     success: function(data)     {     //paramater yang akan ditampilkan di modal         $('[name="no"]').val(data.no);         $('[name="ns"]').val(data.ns);         $('[name="thts"]').val(data.thts);         $('[name="pdf"]').val("http://localhost/dosdm/document/sm/pdf/"+data.thts+"-SK-"+data.ns+".pdf");         var link_base =  "http://localhost/dosdm/document/sm/pdf/"+data.thts+"-SK-"+data.ns+".pdf" ;             $('#pdf_view').attr('src', link_base);                                 //bereksperimen