Search code examples
javasecurityappletvirus

Can Java Applets be dangerous?


So I'm currently reading the "Java A Beginners Guide 7th Edition" book. And the following sentences seemed to me that Applets could be used as virusis. Was this done?

An Applet is a special kind of Java program that is designed to be transmitted over the Internet and automatically executed inside a Java-compatible web browser.

The key feature of applets is that they execute locally...

To me it sounds like it wouldn't be hard to build in a virus into an Applet.


Solution

  • The problem with applets is that they run automatically when you load the page. They're also so complex (compared to html or javascript) it was just to complicated to be able to meaningfully secure them. Run Automatically + Complicated to Secure + Doesn't Update Automatically = impossible to completely secure.

    Regular apps are far far more dangerous to your machine than applets were. But, they don't run automatically when you visit a web page.

    Desktop apps written in languages (like C or C++) where you manipulate the memory with pointers and don't automatically bounds check arrays, are much harder to write securely. Languages (like Java or C#) that don't have pointers and do automatically bounds check arrays are easier to write secure apps in.

    Java includes many safewards to prevent any ill behavior, but time after time, those security features were not enough because of different bugs or design problems.

    As standalone apps they are as safe or risky as any other app. Just make sure to download your app from trusted sources.