[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Is this malware?

J. Clarke

7/17/2014 2:54:00 PM


I had an experience last night that I found to be amusing and thought I
would share it. I was reading through a textbook ("Internet & World
Wide Web How to Program") and doing the exercises, when one little
program would not give a result in the browser. I was tearing my hair
out trying to figure out what stupid error I had made when I noticed
that the Microsoft Security Essentials icon was blue and hovering on it
indicated that it was cleaning malware. So I opened it up to see what
it had found and what it had found was my little textbook exercise.

Now, there's nothing wonderful about this exercise, it's just a beginner
program that totals the numbers from 1 to 100 using a while loop--the
declarations and loop are printed in the text and the exercise is "find
the bugs"--this is the debugged version which I intended to run just to
be sure I hadn't missed anything.

Once I figured out that it was being flagged as malware I poked at it
for a while to see what changes I had to make to make it no longer
flagged. Turns out that if I display the output using an alert box then
it reports as malware but if I generate a paragraph containing the
output then it does not.

So, here are both versions:

This one is flagged as malware by Microsoft Security Essentials (on
Vista--I haven't tried it on anything else):

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Is this malware?</title>
<script type="text/javascript">
<!--
var x = 1;
var total = 0;
while(x<=100) {
total+=x;
++x;
}
window.alert(total);
// -->
</script>
</head>
<body>
<p>Is this malware? 12</p>
</body>
</html>

This one is not flagged:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Is this malware?</title>
<script type="text/javascript">
<!--
var x = 1;
var total = 0;
while(x<=100) {
total+=x;
++x;
}
document.write("<p>"+total+"</p>");
// -->
</script>
</head>
<body>
<p>Is this malware? 11</p>
</body>
</html>

I've already reported this to Microsoft by the way.