TweetFollow Us on Twitter

Volume Number:4
Issue Number:5
Column Tag:Advanced Mac'ing

A Vaccine for the 'nVIR' Virus

By Mike™ Scanlin, Contributing Editor

Unless you are going to Africa or Indochina, viruses and vaccinations are not something that most of us need to worry about. However, even if you’re not planning on travelling, there is one virus you need to be aware of. It is a computer virus that is infecting Macintoshes everywhere. [Note: The virus described in this article is apparently only one of at least three viruses that are going around as reported in the press. This article discusses what we shall name the ‘nVIR’ virus. The other two are the infamous ‘peace message’ virus and the ‘scrapbook’ virus reported in this month’s mousehole column, and in a recent MacWeek article. -Ed]

Are you infected?

Use ResEdit to open your system file and look for ‘nVIR’ resources. If you have them, then your system has been infected and chances are that at least some (if not most or all) of your applications are infected. Don’t panic. This particular virus is relatively harmless. There is an application at the end of this article that will allow you to remove the virus from your infected applications. There is also an ‘INIT’ resource you can put in your System Folder that will warn you if this virus ever shows up on your system. [Note that this vaccine and virus warning init applies only to this particular ‘nVIR’ virus. New vaccines will be necessary for the other two once it is known how they operate. -Ed]

Fig. 1 Vaccination Alert tells Application status

How I found it

Until last week, I had had no experience with computer viruses. I had heard rumors about the existence of Mac viruses, but didn’t really believe them. I do not know when this virus first got into my system. It must have come from some program I downloaded off of a network, but I do not know which one. By the time I figured out what was going on, the virus had modified seventeen of the applications on my hard disk and my System file.

Virus Symptoms

Sometime near the beginning of last week, I started hearing a beep when launching programs. It didn’t happen every time, only once in a while and with no discernable pattern. Using TMON, I trapped SysBeep() and discovered that something was modifying ‘CODE’ 0 and installing several ‘nVIR’ resources into every application I launched. I looked in my System file and, in addition to several ‘nVIR’ resources, found an ‘INIT’ 32 resource that I didn’t put there. I compared the standard ‘INIT’s from an original system disk and none of them matched the ‘INIT’ 32 I had found. What really clued me in to the idea of a virus was that if I took the ‘INIT’ 32 resource out of my System file, quit ResEdit, and then relaunched ResEdit, the ‘INIT’ 32 resource would be back in there. After disassembling ‘INIT’ 32, I learned how it worked and how to make my system immune to it. I am sharing this information so that other Mac users can protect themselves as well. [Note that this virus exhibits the ability to re-install itself after being patched out with ResEdit! -Ed]

How to make your System file immune

Use ResEdit to open your System file. Create an ‘INIT’ 32 resource that consists of these 2 hex bytes: 4E 75 (which is an RTS instruction). If ‘INIT’ 32 already exists and has a size of 366 bytes, then you can be pretty sure it is the virus’ ‘INIT’. Replace the existing ‘INIT’ 32 with the 2 byte version (4E 75). Now create 8 resources of the type ‘nVIR’; the case of the resource type is important -- do not use ‘NVIR’ or ‘nvir’. Their IDs should be 0 through 7, with size zero bytes. If they already exist, then delete them and create 8 new empty ones (with IDs 0-7).

That’s it. Your system is now immune to this particular virus (but not all possible viruses). If you now run an infected application, the virus will think that it is already installed in your system file, since it sees the ‘INIT’ and ‘nVIR’ resources it expects, and will leave it alone.

If your System file was infected before you immunized it, you should reboot the system before using the procedure below to remove the virus from your applications. This guarantees that the effects of ‘INIT’ 32 are removed from memory.

Removing the virus from infected applications

If an application has been infected, it will have several ‘nVIR’ resources, a ‘CODE’ 256 resource, and a possibly modified ‘CODE’ 0 resource. Here are instructions on how to restore an infected application (note: this is only useful if you are certain that your System file is not infected. Otherwise, the applications will become infected again. Also, you should practice on a copy of an infected application):

1) Open the application with ResEdit. If ‘CODE’ 256 exists, use GetInfo on it to check its size. If it is 372 bytes, then remove it. The reason we check for the size is because some applications, such as ReadySetGo, already have a ‘CODE’ 256 resource of their own and we don’t want to remove part of the application’s code.

2) Open ‘CODE’ 0 and look at the 3rd line of 8 hex bytes (bytes 16-23). If it is “0000 3F3C 0100 A9F0” then you need to replace that line of hex numbers with the 8 bytes contained in the ‘nVIR’ 2 resource. If the third line does not look like the above 8 bytes, then the ‘CODE’ resource is probably protected and did not get modified -- see below for an explanation. In this case leave it alone.

3) Remove all ‘nVIR’ resources. Make sure you have completed step 2 before removing ‘nVIR’ 2. You cannot restore the application without it.

Because this procedure is so automatic, I have written a program that does it for you. The application Vaccination displays the SFGetFile dialog and allows you to choose an application to vaccinate. A message is displayed that tells you the result of the vaccination and the SFGetFile dialog is displayed again. If your system has been infected, you should vaccinate every application on your hard drive. You will only see files of type ‘APPL’, ‘FNDR’ (for the Finder), and ‘dahd’ (for the DA handler) in the SFGetFile dialog so you might want to do a manual tree walk of your hard drive to be sure you vaccinate all of your applications. There is no harm in vaccinating an uninfected application or in vaccinating the same application more than once. This program does not make applications immune to this virus, it only removes this virus from them. But if your System file is immune, then there is no way this particular virus can spread to your applications. Note: you cannot use the Vaccination program to make your System file immune. You will have to do that manually using the procedure above.

How this virus works

This particular virus modifies the ‘CODE’ 0 resource of an application in such a way that when you launch that application the first thing to execute is a piece of virus installation code. That installation code looks for the virus’ presence in the System file you are launching from. If it does not find evidence of the virus, it then installs itself (as ‘INIT’ 32 and several ‘nVIR’ resources) into your System file and then executes the application you had originally launched. Once your System file is infected, every application launched from that system will become infected. The whole infection process only takes a second or two, so there is little chance you will notice it. If the virus detects that it is already in the System file and in the application you are launching (meaning that no installation of itself is necessary on this launch), then there is about a 6% chance (1 in 16) that you will hear a short beep. This is the beep that first got my attention. According to a friend of mine, Chris Borton, whose computer was also infected, if you have MacinTalk in your System Folder, then the virus speaks the words “Don’t Panic” instead of beeping.

This virus does not check if the ‘CODE’ 0 resource of the application it is trying to infect is protected or not. Consequently, applications that have ‘CODE’ 0 resources with the resProtected bit set are still infected, but are not contagious, i.e. they have the ‘CODE’ 256 resource and the ‘nVIR’ resources added to them, but they can not pass the virus on to a clean System file. I learned this by noticing that QUED/M and PageMaker were infected, but were not contagious. I couldn’t figure out why some programs had protected ‘CODE’ resources and others didn’t. Then one of the people I work with, Victor Romano, put it together. He told me that Lightspeed C (which QUED/M and PageMaker were written in) automatically sets the resProtected bit of the ‘CODE’ resources it generates. MPW does not. So, protecting the ‘CODE’ resources (which can be done with ResEdit) is another simple way of preventing this virus from affecting an application.

To be forewarned

I don’t know how far this virus has already spread, or how far it will spread. As a partial defense, however, I have written a piece of code that can be installed as an ‘INIT’ file in your System Folder that will warn you if it detects something that looks like this particular virus. VirusWarnINIT is a patch on 2 routines that this virus relies on: GetResource() and ChangedResource(). The patch to GetResource() makes a beep if theType == ‘nVIR’. The patch to ChangedResource() makes a beep if theResource is a handle to a ‘CODE’ 0 resource. I wouldn’t suggest installing this ‘INIT’ in a system known to be infected -- the number of beeps is sure to annoy you. I would have used something like an alert window instead of a beep as a warning, but I can’t be sure that the Window Manager has been initialized at the time the virus is detected. If you install this ‘INIT’ in a clean system and then launch a contagious application, you will hear about 5 or 6 beeps in a row as the virus tries to install itself in your System file.

Note that this ‘INIT’ is only a warning, not a vaccination. The virus will still install itself. The advantage is that you will know about it right away and can stop it before it spreads very far.

Now that my Mac has been vaccinated, it’s my turn. After Typhoid, Yellow Fever, Cholera and Meningococcal vaccinations, I’m off to Africa and Indochina. I wonder if I can get David Smith to send MacTutor to Serengeti National Park? Or do they already get it there? I’ll let you know

/* Vaccination.c
   * by Mike™ Scanlin   12 March 88
   * Removes the ‘nVIR’ virus from an 
 * application chosen by the user.

#define NIL 0L
#define reg register


#define nVIR_CODE_256_SIZE372

#define nVIR2Bad -10
#define nVIR2NotFound-11

void    RemoveResourceFromFile(long theType, int theID, int    
intInnoculate(Str255 *fileName, int vRef);
void    pStrCpy(char *p2, char *p1);
Boolean ChooseFile(Str255 *fn, int *vRef);
void    main(void);

static  SFReply  reply;
static  int applResFile;

/* RemoveResourceFromFile(theType, theID, refNum)
   * This will remove the resource of type theType 
 * and ID theID from the open resource file
   * whose refNum is refNum.
void  RemoveResourceFromFile(theType, theID, refNum)
long  theType;
 reg Handle theResource;
 if ((theResource = GetResource(theType, theID)) && (HomeResFile(theResource) 
== refNum))

/* Innoculate(fileName, vRef)
  * This removes the ‘nVIR’ virus from *fileName 
 in directory vRef.
int     Innoculate(fileName, vRef)
reg Str255*fileName;
 reg Handle oldCODE, currentCODE;
 reg inti, refNum, returnVal;
 ParamBlockRec   pb;
 /* init the ParamBlockRec to all zeros */
 asm {
 lea    pb,A0
 move.l #sizeof(ParamBlockRec),D0
 subq.l #1,D0
 dbra D0,@1
 /* set the current working directory */
 pb.ioParam.ioVRefNum = vRef;
 PBHSetVol(&pb, FALSE);
 refNum = OpenResFile(fileName);
 if ((oldCODE = GetResource(‘nVIR’, 2)) && (HomeResFile(oldCODE) == refNum)) 
 if (GetHandleSize(oldCODE) != 8)
 /* if ‘nVIR’ 2 isn’t 8 bytes, then something 
 isn’t right. */
 returnVal = nVIR2Bad;
 else {
 if ((currentCODE = GetResource(‘CODE’, 0)) && (HomeResFile(currentCODE) 
== refNum)) {
 asm {
 MOVE.L (A1),A1
 MOVE.L currentCODE, A0
 MOVE.L (A0),A0
 ADDA #16, A0
 MOVE.L (A1)+, (A0)+
 MOVE.L (A1), (A0)
 /* kill the ‘nVIR’ resources */
 for (i = 0; i <= 7; i++)
 RemoveResourceFromFile(‘nVIR’, i, refNum);

 /* kill the extra ‘CODE’ resource that this 
 virus adds (only if it has the size 
 of nVIR_CODE_256_SIZE) */
 if ((currentCODE = GetResource(‘CODE’, 256)) &&
 (GetHandleSize(currentCODE) == 
 nVIR_CODE_256_SIZE) && (HomeResFile(currentCODE) 
 == refNum))
 returnVal = noErr;
 returnVal = nVIR2NotFound;
 if (refNum != applResFile)

/* pStrCpy(p2, p1)
  * Copy the pascal string at *p1 to *p2.
void pStrCpy(p2, p1)
reg char*p2, *p1;
 reg intlen;
 len = *p2++ = *p1++;
 while (--len >= 0) 
 *p2++ = *p1++;

/* ChooseFile(fn, vRef)
   * Use SFGetFile() to get the name of an 
 * application from the user. Return the directory
   * of the chosen file in *vRef. Return FALSE if the 
 * user clicked Cancel, TRUE if they clicked
   * Open.
  * Thanks to Chris Borton for this routine.
Boolean ChooseFile(fn, vRef)
Str255  *fn;
 SFTypeList myTypes;
 static Point  SFGwhere = { 90, 82 };
 myTypes[0] = ‘APPL’;
 myTypes[1] = ‘FNDR’;
 myTypes[2] = ‘dahd’;
 SFGetFile(SFGwhere, NIL, 0L, 3, myTypes, 0L, &reply);
 if (reply.good) {
 pStrCpy((char *)fn , (char *)reply.fName);
 *vRef = reply.vRefNum;

void main() {
 Str255 fileName;
 int    vRef;
 /* save the application’s resource file refNum */
 applResFile = CurMap;

 /* keep choosing files until the user hits Cancel */
 while (ChooseFile(&fileName, &vRef)) {
 switch (Innoculate(&fileName, vRef)) {
 case   nVIR2Bad:
 ParamText(&fileName, “\pResource ‘nVIR’ 2 is not 8 bytes long. File 
cannot be repaired.”, NIL, NIL);
 case nVIR2NotFound:
 ParamText(&fileName, “\pResource ‘nVIR’ 2 not found. File is not infected 
or cannot be repaired.”, NIL, NIL);
 ParamText(&fileName, “\pVirus successfully removed.”, NIL, NIL);
 /* show the result of the attempted removal */

/* VirusWarnINIT.c
   * by Mike™ Scanlin   13 March 88
   * Put this in your system folder to warn you 
 * about the ‘nVIR’ virus.
   * It patches GetResource() and ChangedResource().
#include “Asm.h”
#include “ResourceMgr.h”

#define GetResource0xA9A0
#define ChangedResource 0xA9AA
#define JMP 0x4EF9
#define memFullErr -108
#define beepDuration 20

void  main(void);

void  main()
 asm  {

/* beginning of the code that installs the patches */

 move.l D3,-(SP)
/* get the original GetResource address */   
 move #GetResource,D0
/* set up the JMP instruction that calls the original GetResource */
 lea    @origGR,A1
 move #JMP,(A1)+
 move.l A0,(A1)

/* get the original ChangedResouce address */
 move #ChangedResource,D0
/* set up the JMP instruction that calls the original ChangedResource 
 lea    @origCR,A1
 move #JMP,(A1)+
 move.l A0,(A1)

/* get some space in the system heap for the patches */
 lea    @last,A0
 lea    @first,A1
 suba.l A1,A0    /* the length of our patches */
 move.l A0,D0
 add.l  #254,D0  /* the extra space for the Str255 at the end (@name) 
 move.l D0,D3    /* save for _BlockMove */
 cmpi   #memFullErr,D0
 beq.s  @noPatch
 move.l A0,-(SP) /* save for _BlockMove */
 move.l (SP),-(SP) /* for _SetTrapAddress */

/* set GetResource to the beginning of the space we just got in the system 
heap */
 move #GetResource,D0

/* set ChangedResource trap */
 lea    @changedResouce,A0
 lea    @getResource,A1
 suba.l A1,A0
 adda.l (SP)+,A0
 move #ChangedResource,D0
/* now move it into place */
 lea    @first,A0
 move.l (SP)+,A1
 move.l D3,D0

@noPatchmove.l (SP)+,D3
/* end of the code that installs the patches */


  * This is the patch to GetResource
 move.l 6(SP),D0 /* get theType */
 cmpi.l #’nVIR’,D0
 bne.s  @origGR

/* at this point we know something is trying to load an ‘nVIR’ resource 
 move #beepDuration,-(SP)
/* note that this is only a warning beep, it falls through 
 * to the original GetResource, so the calling function 
 * never knows that it was detected. */
@origGR nop /* JMP to original trap */

  * This is the patch to ChangedResource

/* call GetResInfo() to see if we are changing a CODE 0 resource */
 move.l 4(SP),-(SP)/* copy the resource handle 
 * that was passed to
   * ChangedResouce() */
 pea    @theID
 pea    @theType
 pea    @name
 lea    @theType,A0
 move.l (A0),D0
 cmpi.l #’CODE’,D0
 bne.s  @origCR
 lea    @theID,A0
 tst    (A0)
 bne.s  @origCR

/* give a warning beep a CODE 0 resource is being changed */   
 move #beepDuration,-(SP)
@origCR nop /* JMP to original trap */
@theID  dc0
@name   dc0 
 /* there are actually 254 more bytes to this
 * variable (for a total of 256). Check the
 * add.l #254,D0 instruction in the install code. */


Community Search:
MacTech Search:

Software Updates via MacUpdate

Cyberduck 4.7 - FTP and SFTP browser. (F...
Cyberduck is a robust FTP/FTP-TLS/SFTP browser for the Mac whose lack of visual clutter and cleverly intuitive features make it easy to use. Support for external editors and system technologies such... Read more
Labels & Addresses 1.7 - Powerful la...
Labels & Addresses is a home and office tool for printing all sorts of labels, envelopes, inventory labels, and price tags. Merge-printing capability makes the program a great tool for holiday... Read more
teleport 1.2.1 - Use one mouse/keyboard...
teleport is a simple utility to let you use one single mouse and keyboard to control several of your Macs. Simply reach the edge of your screen, and your mouse teleports to your other Mac! The... Read more
Apple iMovie 10.0.8 - Edit personal vide...
With an all-new design, Apple iMovie lets you enjoy your videos like never before. Browse your clips more easily, instantly share your favorite moments, and create beautiful HD movies and Hollywood-... Read more
Box Sync 4.0.6233 - Online synchronizati...
Box Sync gives you a hard-drive in the Cloud for online storage. Note: You must first sign up to use Box. What if the files you need are on your laptop -- but you're on the road with your iPhone? No... Read more
Fantastical 2.0.3 - Create calendar even...
Fantastical 2 is the Mac calendar you'll actually enjoy using. Creating an event with Fantastical is quick, easy, and fun: Open Fantastical with a single click or keystroke Type in your event... Read more
The Hit List 1.1.14 - Advanced reminder...
The Hit List manages the daily chaos of your modern life. It's easy to learn - it's as easy as making lists. And it's powerful enough to let you plan, then forget, then act when the time is right.... Read more
Path Finder 7.1.4 - Powerful, award-winn...
Become a master of file management with Path Finder. Take full control over your file system. Save your time: compare and synchronize folders, view hidden files, use Dual Pane and full keyboard... Read more
PhotoStyler 6.8.2 - Add a sense of reali...
PhotoStyler is the easiest way to style your digital photos with your Mac. This simple, fast and accurate native solution combines the powers of Apple's core technologies with the flexibility and... Read more
Astropad 1.1 - Turn your iPad into a gra...
Note: Requires iPad companion app. ($24.99) Astropad transforms your iPad into a professional graphics tablet for your Mac. Use your iPad to draw directly into Photoshop and any other Mac creative... Read more

SoundHound + LiveLyrics is Making its De...
SoundHound Inc. has announced that SoundHound + LiveLyrics, will be one of the first third-party apps to hit the Apple Watch. With  SoundHound you'll be able to tap on your watch and have the app recognize the music you are listening to, then have... | Read more »
Adobe Joins the Apple Watch Lineup With...
A whole tidal wave of apps are headed for the Apple Watch, and Adobe has joined in with 3 new ways to enhance your creativity and collaborate with others. The watch apps pair with iPad/iPhone apps to give you total control over your Adobe projects... | Read more »
Z Steel Soldiers, Sequel to Kavcom'...
Kavcom has released Z Steel Soldiers, which continues the story of the comedic RTS originally created by the Bitmap Brothers. [Read more] | Read more »
Seene Lets You Create 3D Images With You...
Seene, by Obvious Engineering, is a 3D capture app that's meant to allow you to create visually stunning 3D images with a tap of your finger, and then share them as a 3D photo, video or gif. [Read more] | Read more »
Lost Within - Tips, Tricks, and Strategi...
Have you just downloaded Lost Within and are you in need of a guiding hand? While it’s not the toughest of games out there you might still want some helpful tips to get you started. [Read more] | Read more »
Entertain Your Pet With Your Watch With...
The Petcube Camera is a device that lets you use live video to check in on your pet, talk to them, and play with them using a laser pointer - all while you're away. And the Petcube app is coming to the Apple Watch, so you'll be able to hang out with... | Read more »
Now You Can Manage Your Line2 Calls With...
You'll be able to get your Line2 cloud phone service on the Apple Watch very soon. The watch app can send and receive messages using hands-free voice dictation, or by selecting from a list of provided responses. [Read more] | Read more »
R.B.I. Baseball 15 (Games)
R.B.I. Baseball 15 1.01 Device: iOS Universal Category: Games Price: $4.99, Version: 1.01 (iTunes) Description: The legendary Major League Baseball franchise returns to the diamond. Make History. ** ALL iPOD Touch, the iPad 2 and the... | Read more »
Here's How You Can Tell if an App W...
The Apple Watch is pretty much here, and that means a whole lot of compatible apps and games are going to be updated or released onto the App Store. That's okay though, beacause Apple has quietly updated their app description pages to make things... | Read more »
Forgotten Memories : Alternate Realities...
Forgotten Memories : Alternate Realities 1.0.1 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0.1 (iTunes) Description: + REDUCED PRICE ONLY THE LAUNCHING WEEK + "The most exciting horror game of 2015." - AppSpy... | Read more »

Price Scanner via

Heal to Launch First One-Touch House Call Doc...
Santa Monica, California based Heal, a pioneer in on-demand personal health care services — will offer the first one-touch, on-demand house call doctor app for the Apple Watch. Heal’s Watch app,... Read more
Mac Notebooks: Avoiding MagSafe Power Adapter...
Apple Support says proper usage, care, and maintenance of Your Mac notebook’s MagSafe power adapter can substantially increase the the adapter’s service life. Of course, MagSafe itself is an Apple... Read more
12″ Retina MacBook In Shootout With Air And P...
BareFeats’ rob-ART morgan has posted another comparison of the 12″ MacBook with other Mac laptops, noting that the general goodness of all Mac laptops can make which one to purchase a tough decision... Read more
FileMaker Go for iPad and iPhone: Over 1.5 Mi...
FileMaker has announced that its FileMaker Go for iPad and iPhone app has surpassed 1.5 million downloads from the iTunes App Store. The milestone confirms the continued popularity of the FileMaker... Read more
Sale! 13-inch 2.7GHz Retina MacBook Pro for $...
 Best Buy has the new 2015 13″ 2.7GHz/128GB Retina MacBook Pro on sale for $1099 – $200 off MSRP. Choose free shipping or free local store pickup (if available). Price for online orders only, in-... Read more
Minimalist MacBook Confirms Death of Steve Jo...
ReadWrite’s Adriana Lee has posted a eulogy for the “Digital Hub” concept Steve Jobs first proposed back in 2001, declaring the new 12-inch MacBook with its single, over-subscribed USB-C port to be... Read more
13-inch 2.7GHz Retina MacBook Pro for $1234 w...
Adorama has the 13″ 2.7GHz/128GB Retina MacBook Pro in stock for $1234.99 ($65 off MSRP) including free shipping plus a free LG external DVD/CD optical drive. Adorama charges sales tax in NY & NJ... Read more
13-inch 2.5GHz MacBook Pro available for $999...
 Adorama has the 13-inch 2.5GHz MacBook Pro on sale for $999 including free shipping plus NY & NJ sales tax only. Their price is $100 off MSRP. Read more
Save up to $600 with Apple refurbished Mac Pr...
The Apple Store is offering Apple Certified Refurbished Mac Pros for up to $600 off the cost of new models. An Apple one-year warranty is included with each Mac Pro, and shipping is free. The... Read more
Updated MacBook Price Trackers
We’ve updated our MacBook Price Trackers with the latest information on prices, bundles, and availability on 12″ MacBooks, MacBook Airs, and MacBook Pros from Apple’s authorized internet/catalog... Read more

Jobs Board

*Apple* Retail - Multiple Positions (US) - A...
Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, you're also the Read more
*Apple* Watch SW Application Project Manager...
**Job Summary** The Apple Watch software team is looking for an Application Engineering Project Manager to work on new projects for Apple . The successful candidate Read more
Map Services Frameworks Manager - *Apple* M...
Job Description: Apple 's Maps Evaluation Organization is seeking a Senior Manager to lead the Map services assertions and performance frameworks group. Key Read more
Shuttle Driver - APPLE EAST, APPLE EAST (Unit...
HERE WE GROW AGAIN!! We are adding to our team! Red Lion Chevrolet of Apple Automotive is growing and we are looking for a PART TIME SHUTTLE DRIVER/ PORTER FOR SERVICE Read more
*Apple* Retail - Multiple Positions (US) - A...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.