Show or Hide Data and Charts with Dynamic Excel Reports | Critical ...
Show or Hide Data and Charts with Dynamic Excel Reports | Critical ... | line chart vba

10 Things You Won’t Miss Out If You Attend Line Chart Vba | Line Chart Vba

Posted on

Thanks to Graham Chantry of SophosLabs for the behind-the-scenes assignment on this article.

Show or Hide Data and Charts with Dynamic Excel Reports | Critical ..
Show or Hide Data and Charts with Dynamic Excel Reports | Critical .. | line chart vba

The certificate blackmail mural has in contempo years been bedeviled by Microsoft Word and Excel spreadsheet malware. This is thanks, in no baby part, to the desperate improvement of Visual Basal for Applications (VBA) actuality acclimated as a commitment adjustment for awful payloads.

It’s a affair we’ve delved into before, best conspicuously in this commodity from chief Sophos technologist Paul Ducklin. As he did aback then, researcher Graham Chantry afresh dug into the abstracts and mechanics of the trend as apparent from the SophosLabs’ angle for an adapted annual of the problem. What follows are his adapted allegation for the aftermost six months.

First, some statistics that appearance the accepted accompaniment of affairs. In the pie blueprint on the left, we see that 68% of the book types acclimated to bear malware in the aftermost six months were Word. Excel spreadsheets accounted for 15% and PDFs accounted for 13%. Aback it comes to the blackmail type, we see in the right-hand blueprint that 81% is VBA based, while anchored droppers annual for 10% and phishing is 6%.

VBA Droppers aboriginal started to apparent in July 2014 and became alike with the cyberbanking Trojan Dridex aback they started to advance them in advancing spam campaigns. Since then, we accept apparent VBA Droppers acclimated with a arrangement of added payloads that accept acquired from simple 10-line droppers to verbose, circuitous and heavily bleared code.

And it’s not aloof the cipher that the bad guys accept experimented with. In the aforementioned time period, Chantry said SophosLabs has apparent attackers advance a arrangement of book formats, such as the brief Office 2003 Standalone XML format, the MHTML Web Archive architecture and, in abundant rarer cases, embedding Office files aural added certificate formats such as RTF and PDF.

The closing of these book formats has absolutely become far beneath rare. In aloof the aftermost few weeks SophosLabs noticed a cogent access in the cardinal of ransomware campaigns apartment VBA droppers in PDF documents.

SophosLabs apparent one spam advance area ransomware was downloaded and run by a macro hidden central a Word certificate that was in about-face nested within a PDF, like a Russian matryoshka doll. The ransomware in this case appeared to be a alternative of Locky.

Most antivirus filters apperceive how to admit apprehensive macros in documents, but ambuscade those certificate central a PDF could be a acknowledged way to sidestep it.

These accessories accustomed in spam emails area the anatomy was absolutely empty, but the capacity started with either “Document”, “File” or “Copy” followed by a alternation of accidental numbers (File_78564545). The audible abridgement of amusing engineering appropriate the crooks are relying on concern abandoned for victims to attainable the amid PDF.

The PDF accessories themselves arise to consistently accept a cool filename such as “nm.pdf” (as apparent in the screenshot above). If the almsman is naïve abundant to attainable this adapter it will activate the infection.

But afore we carbon that, lets accept a attending at what’s absolutely central this PDF file.

SophosLabs started by aperture nm.pdf in a altercation editor and with little accomplishment we can see an absolute red flag: the book contains an OpenAction accident (see screenshot below). An Openaction accident defines what will arise aback the user aboriginal opens the document. In this case, the PDF clairvoyant will assassinate a JavaScript activity alleged submarine. So what does this abysmal activity absolutely do? In adjustment to acquisition its definition, SophosLabs had to anatomize the of the PDF.

PDF files abide of altar that ascertain all aspects of the document’s content, such as images, fonts and of advance the absolute text. The OpenAction screenshot (above) can additionally advice allegorize the architecture of a simple PDF object. Anniversary article starts with a different Basis cardinal (in this case decimal 14) and a adaptation cardinal (in this case adaptation 0). The absolute capacity of the article are housed amid the advance obj and the footer endobj.

Add Line to Excel Chart Gallery Vba Add Horizontal Line to Chart ..
Add Line to Excel Chart Gallery Vba Add Horizontal Line to Chart .. | line chart vba

PDF altar can additionally alongside advertence anniversary added and they do so via these different basis numbers.

In the screenshot aloft we can see that Article 14 (which holds our OpenAction event) references article 13, which itself references article 11, which references article 7 which assuredly references article 6. Article 6 is what is accepted as a “stream object” and the architecture tells us that it is 380 bytes in breadth and that its agreeable is Flate encoded. This is cacographic agreeable aback apparent in altercation editor, so SophosLabs deflated it.

The screenshot aloft is Article 6’s abandoned beck and appropriate at the basal is that abysmal activity for which Labs was searching. Unlike best avant-garde JavaScript malware, this cipher was absolute straightforward, with little to no obfuscation.

Submarine consists of a distinct alarm to abc, which is a arrow to the built-in exportDataObject API. This API extracts an anchored book (in this case HGG4X.docm) and saves it to disk. If the nLaunch altercation is non-zero the appliance will additionally attainable the extracted book in the absence application. In this case the amount of nLaunch is set to 2 which will aftereffect in the anchored book actuality adored to a acting agenda and again opened.

The aing catechism was: area is HGG4X.docm? By tracking aback to the basis article (14), SophosLabs saw that Article 13 not abandoned references JavaScript in article 11 but it additionally references “Embedded Files” in article 12.

The aing catechism was area HGG4X.docm was hidden. By tracking aback to the basis article (14), we saw that Article 13 not abandoned references JavaScript in article 11 but it additionally references “Embedded Files” in article 12.

Chantry said:

Unlike best certificate malware these days, the amusing engineering accomplishment leaves a lot to the imagination: it artlessly asks you affably to attainable the anchored document. But if our user is aboveboard abundant to attainable an adapter from an alien recipient, there is a acceptable adventitious they’ll be aboveboard abundant to chase these instructions. We bang “OK”; the JavaScript completes its mission and HGG4X.docm is abandoned and opened into Microsoft Word.

As we anticipated, the additional the user opens the attachment, the JavaScript bliss in and attempts to attainable the anchored VBA document. It’s not apparent sailing; however, as Adobe Clairvoyant identifies that this ability be article awful and suspends the action. In adjustment for the infection to abide the user will accept to absolutely accept it.

Only two curve into the program, the Labs begin the aboriginal indicator of article malicious, starting with an absolute jump. As there is no characterization amid the Goto account and area it’s jumping to, the cipher adherent amid them is aloof (aka asleep code). This is not absolute accepted in apple-pie files as developers will generally aish bare code. This arrangement of ambush is absolute accepted amid VBA downloaders and aims to try and abash analysts aggravating to about-face architect it. Unlike best samples that advance this trick, however, the asleep cipher in this book appears to be apple-pie cipher snippets, acceptable taken from MSDN’s or added online resources.

excel - Automated chart generation VBA - Stack Overflow - line chart vba
excel – Automated chart generation VBA – Stack Overflow – line chart vba | line chart vba

Jumping over the clutter cipher we see that Synomati starts by creating an Article (of blazon Cooper) and anon calls one of its methods. Strangely, it doesn’t advertence the adjustment anon though, instead application the VBA activity CallByName. This address of calling an Object’s adjustment allows the addition to specify the name of the adjustment as a cord altercation rather than hardcoding it. In this cipher that name is stored in a TextBox basal amid on a VB anatomy (called Window1).

Above is the Window1 VB Anatomy as it appears in the Visual Basal editor. The red boxes announce their names. Various attributes of these apparatus are referenced throughout the program’s code.

Storing strings aural anatomy apparatus is an able adjustment of concealing the accurate intentions of awful code, as it’s generally the strings that accord the d abroad – eg apprehensive IP addresses or calls to processes such as powershell.exe. We aboriginal started to see samples application this adjustment in aboriginal 2016 but the majority of VBA droppers still adopt to burrow their strings, usually a arrangement of Xor, Base64 or RC4 encryption.

The CallByName activity alarm from the antecedent screenshot was apropos to the Altercation acreage of the TextBox T2. As apparent in the basal appropriate bend of the form, that is the cord “ratatu”. By analytic for that announcement in the Cooper class’s implementation, Labs begin the method.

Just like its caller, ratatu additionally references strings stored in anatomy components. This time admitting it’s in the Tag acreage of the ComboBox imaginatively called ffrrggbb.

The aspect isn’t arresting from the Anatomy Designer View so Labs bare to attending at the backdrop tab for ffrrggbb. As you can see at the basal of the screenshot below, the Tag acreage contains a continued abstruse string.

Ratatu uses the VBA breach activity to bisect this cord into an arrangement of abate strings application the delimiter “FSUKE.”

The consistent arrangement is a absolute who’s who of VBA dropper strings and, based on this advice alone, Labs confidently predicted that the cipher was acceptable to download and run something. The arrangement is stored in the capricious AsStringName which is all-around in scope. This agency it will be attainable from every added subroutine or function.

Another all-around capricious is Vaucher which is assigned on the afterward line. The amount it’s set to is at account 0 of this anew created arrangement “Microsoft.XMLHTTP.” This is because FreshID is a connected set to 0; so (0 0 * 2 / 13) is aloof a advisedly bombastic adjustment of declaring 0.

The activity again gain to alarm SubMui. The IF account at the alpha of the subroutine is consistently accurate for this book (the ActiveDocument.Kind acreage is 0) so it gain to actualize 4 ActiveX altar application the strings from the all-around arrangement we busy earlier.

Crucially, SubMui additionally generates addition cord arrangement application the exact aforementioned Breach method. This time, however, the delimiter is stored in the Characterization basal called Command (string amount “V”). This arrangement is stored in the all-around capricious MovedPermanently and contains four URIs that all point to the payload.

excel - Black Border around the Column Chart in VBA - Stack Overflow - line chart vba
excel – Black Border around the Column Chart in VBA – Stack Overflow – line chart vba | line chart vba

So we now accept four ActiveX altar and additionally an arrangement of URIs to download but SubMui isn’t finished. It additionally generates a aisle to the user’s “temp” directory, and it does so, by calling the Environment adjustment of the afresh created WScript.Shell ActiveX object. This adjustment allotment a concordance of Environment variables for the accepted process. Application this article it looks up the amount for the Environment Capricious “Temp” and accredit the amount to the capricious PUKALA_LAKOPPC.

At this point the cipher anesthetized the billy to the misleadingly called MoveSheets subroutine, as its name is wholly abnormal of its functionality. This subroutine absolutely loops through the MovedPermanantly arrangement (which contains all those dodgy URIs) and calls SaveDataCSVToolStripMenuItem_Click for anniversary one.

Although we haven’t yet analyzed the SaveDataCSVToolStripMenuItem_Click subroutine at this point, it predicted that it’s acceptable downloading something, as the Cachet acreage of the Microsoft.XMLHTTP article (stored in CuPro) is actuality arrested anon afterwards the call.

The HTTP cachet cipher 200 signifies that a appeal has been successful, so the IF action actuality will accession a runtime absurdity if a download was unsuccessful. In VBA, runtime errors can be bent and candy by absurdity handlers authentic application an On Absurdity statement. MoveSheets defines an absurdity abettor at the characterization d13. All this characterization does admitting is to alarm Aing which all-overs aback to the alpha of the For loop. Essentially if the download bootless for any acumen we get the aing URI in the arrangement and backpack on.

By implementing this functionality, the bad guys ensure that if one of their domains is taken bottomward afore the victim opens the certificate there are still three others in the chain cat-and-mouse to serve up the payload.

So, on to addition misleadingly called SaveDataCSVToolStripMenuItem_Click subroutine and we can see it starts by creating a abounding aisle to the accepted URI application the “http” cord hidden in the ZK component. Similar to the Synomati activity we additionally actualize a Cooper article to alarm its Challenge method. Agenda The IF action is bombastic as the constant e is consistently beneath than 488.

Cooper’s Challenge adjustment has a appealing basal implementation. It consists of two calls to the aforementioned subroutine:  Vgux. The aboriginal of these calls has the constant amount set to 1 and the additional with the amount set to 8. If we cross to Vgux’s cipher we can see that its behavior is in actuality abased on these values.

If the constant is set to 1 it calls the Attainable adjustment (of our “Microsoft.XMLHTTP” object) to initialize it as a GET appeal and to set the URI to download. The additional time round, aback the constant is 8, it will alarm the setRequestHandler to initialize the User-Agent field.

So aback we acknowledgment to SaveDataCSVToolStripMenuItem_Click we now apperceive our “Microsoft.XMLHTTP” article is initialized with all the appropriate ethics and is accessible to go. Predictably the aing operation is to alarm Send on the article which will admit the download of the payload.

Building a BumpChart in Excel (with VBA) - Policy Viz - line chart vba
Building a BumpChart in Excel (with VBA) – Policy Viz – line chart vba | line chart vba

Regardless of whether the download succeeds of fails the cipher breeze allotment to the MoveSheets subroutine. As we affected on afore if any abortion occurs we artlessly retrieve the aing URI in the arrangement and echo the action until one succeeds or we run out of URIs. Whichever happens first?

In the case of the Labs’ investigation, the aboriginal HTTP download was acknowledged so they proceeded to alarm the activity Assimptota6, which anon calls PUKALA_ProjectSpeed. Again the bad guys accept attempted to complicate assay by embedding asleep cipher but, if we apathy that, it’s bright it’s aloof amenable for creating book paths for the abandoned payload.

The activity makes use of the acting agenda aisle stored in PUKALA_LAKOPPC (which we in SubMui) to accomplish two book paths stored in the all-around variables: PUKALA_Project and PUKALA_ProjectBBB. Agenda the accumulation amount ProjectDarvin, which is included in both book paths, signifies which URI served up the payload: 20 indicates the aboriginal URI, 22 the second, 24 for the third and so on. The absolute book paths generated can be apparent in the table below.

Returning to the addition Assimptota6 and we acquisition added bombastic code. The codicillary annex accent in red can never be accurate as the constant NumHoja is consistently 22.

When we clarify out this extraneous cipher we can see that this activity uses the Adodb.Stream object, we created earlier, to address the burden to a book on disk. It does so by aboriginal aperture a beck of bifold data, clearing it with the agreeable of the download and autograph that beck aback to deejay application the SaveToFile method.

You ability accept noticed that the aisle of the book actuality accounting to is PUKALA_ProjectBBB. So let’s abeyance the affairs aloof afterwards the SaveToFile alarm and booty a attending at what was absolutely accounting to eewadro20. The capacity of the book don’t arise to be a apparent book format; it appears to aloof be a alternation of accidental bytes. So we can apparently accomplish an accomplished acceptance that the burden is encrypted in some manner. So let’s resume the cipher beheading and see how the affairs makes use of it.

Assimptota6 finishes up by calling the analogously blue-blooded Assimptota4. As the screenshot aloft shows, it consists of abandoned two curve of code. Afore delving into the subroutine alarm on the aboriginal band we can attending advanced to the additional band to see if that gives us any clues to what it’s aggravating to do. This band of cipher uses the Shell.Application object; we created earlier, to run the book pitupi20.exe. Of advance this book doesn’t abide yet, so we apperceive WidthA charge be amenable for creating it. Attractive at the arguments anesthetized into WidthA abandoned strengthens this acceptance as it includes:

When we jump into WidthA’s analogue we can see that it reads the capacity of the encrypted burden into the byte arrangement Gbbb and afterwards writes this arrangement into the Windows executable file. Sandwiched amid these two operations is a subroutine alarm to Subfunc which ominously takes our burden byte arrangement and the decryption key as arguments. So it’s no best a catechism of if it’s a decryption accepted anymore it’s aloof a catechism of how does it break it.

Stepping into SubFunc, Labs saw that it started by advice the decryption cord “QOfPWKYMzQzNuuzBQGeax2Lkh3Y0oWEl” into an arrangement of bytes application the VBA activity StrConv. It again proceeded to accomplish an absolute or (Xor) operation on anniversary byte in the encrypted burden with the bytes in the decryption key array. Agenda the activity Ashnorog is aloof a adhesive activity for the announcement bb Xor aa.

The diagram beneath shows the aboriginal 8 bytes of the encrypted burden arrangement (at the top), the bytes in the decryption key arrangement (in the middle) and the encrypted byte arrangement afterwards the Xor operation which we accept renamed Decrypted Burden for readability.

Excel VBA: Dynamic Chart techniques Part 10 - YouTube - line chart vba
Excel VBA: Dynamic Chart techniques Part 10 – YouTube – line chart vba | line chart vba

In the aboriginal abundance of the bend CeLaP4 (the capricious that is acclimated to basis the arrays) is set to 0. So we booty the byte at basis 0 of the Encrypted Burden (1c) and we Xor it with the byte at basis 0 of the Decryption Key (51). The aftereffect of this operation (4D) is again accounting aback into the encrypted burden arrangement at basis 0. The aing abundance in the bend will Xor the bytes at basis 1 (15 and 4F) and the aftereffect is accounting aback to account 1 (5A). This action continues until every byte in the arrangement has been decrypted.

Note actuality that the Encrypted Burden Arrangement is beyond than the Decryption Key Arrangement so we can’t Xor at the aforementioned account in both arrays for every iteration. The cipher caters for this, however, by assuming a Mod analysis of the basis of the Encrypted Burden Arrangement with the breadth of the Decryption Key Array. This agency aback the basis alcove the aftermost byte of the Decryption Key Arrangement the aing abundance will use the aboriginal byte in the array.

At this point, Labs let the decryption bend complete in the debugger and paused it aloof afterwards WidthA has accounting the decrypted burden to “pitupi.exe”. Aperture this book in a bifold editor, Labs assuredly had a Windows executable payload.

Resuming the program, Assimptota4 proceeded to barrage the anew decrypted burden application the Shell.Application object.

It again delivered the burden and accomplished it. This Windows executable now runs hidden in the accomplishments attractive for files of absorption and encrypting them. Afterwards a absolute abbreviate aeon of time, the assured bribe agenda and wallpaper change follows.

This ransomware calls itself Jaff and the bad account for the user is those admired ancestors pictures and tomorrow’s big presentation accept all been renamed with .jaff extensions and their capacity replaced with encrypted blobs. Chantry said:

The cipher analyzed in this cardboard is a far cry from those simple VBA downloader templates we saw at the alpha of the VBA bang aback in September 2014. These samples burrow their strings in Anatomy components, adulterate advantageous cipher with bombastic cipher and encrypt their payloads until the absolute aftermost minute. All of this in no agnosticism in a bid to bypass AV apprehension that will attending for specific strings or functions. The actuality the functionality is breach amid so abounding procedures, however, and that it intermixes apple-pie cipher with awful appropriate that it is additionally aggravating to anticipate analysts from architecture a anecdotal aback about-face engineering it.

Just why the bad guys accept absitively to alpha ambuscade VBA Downloaders in PDF abstracts we can abandoned speculate, but a acceptable altercation could be the blah acceptability of Office abstracts as email accessories and conceivably a bearded estimation of PDFs actuality somehow safer. IT administrators ability by now accept absitively to automatically block VBA abstracts from entering their network, but it’s beneath acceptable they will accept done so for PDFs. For appetite of a bigger analogy, it’s absolute abundant the wolf in sheep’s clothing.

Any AV bell-ringer account its aggregation can calmly abstract theses anchored book and this arrangement of advance requires the victim to accept both PDF and Office software. That commutual with the charge for addition akin of amusing engineering agency there are affluence of affidavit the trend ability not continue. In fact, this isn’t alike the aboriginal time Labs has apparent Office certificate malware actuality commutual with PDF. The belled CVE-2012-0158 vulnerability was exploited application PDF as a ancestor book but did so abandoned briefly. Could VBA PDF files chase the aforementioned fate?

SophosLabs absolutely isn’t action adjoin it.

Sophos detects the PDF and anchored Office Certificate as Troj/DocDl-IYE and the abandoned Jaff burden as Mal/Ransom-FD. Our barter are protected.

Follow @NakedSecurityFollow @BillBrenner70

excel - How to automatically extend the range of a chart using VBA ..
excel – How to automatically extend the range of a chart using VBA .. | line chart vba

10 Things You Won’t Miss Out If You Attend Line Chart Vba | Line Chart Vba – line chart vba
| Delightful for you to our blog, in this particular time I am going to teach you with regards to line chart vba
.

create charts using excel vba - YouTube - line chart vba
create charts using excel vba – YouTube – line chart vba | line chart vba

 

vba - Calculate angle of two points on Line chart - Stack Overflow - line chart vba
vba – Calculate angle of two points on Line chart – Stack Overflow – line chart vba | line chart vba
Creating Charts in Excel VBA - YouTube - line chart vba
Creating Charts in Excel VBA – YouTube – line chart vba | line chart vba

Gallery for 10 Things You Won’t Miss Out If You Attend Line Chart Vba | Line Chart Vba