This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
knowingYou's profile picture

[IMPORTANT]REAL virus! Please fix!

Started by knowingYou, 17 March 2012 - 06:03 PM
knowingYou #1
Posted 17 March 2012 - 07:03 PM
I just want to point to some security vulnerabilities opened by ComputerCraft.
The main point is the file system with full, umlimited write access. Okay, you are not able to write outside of the computer directory, but there are other problems.

First: See this script as an example for disk exhaustion. Workaround: Add an option to limit space used by single computers/disks.

Second: Another (not obvious) hole is the possibilty to create files / folders. There are several options to destroy/damage the real computer's file system.
  1. Create many files: By creating really many files (could be possible for multiple computers) you can make your file system instable. I had a HDD with a folder containing some sub-folders (IDK how many, guess something greater 2,000,000,000) and was not able to delete the folder! I tried for hours. Once I opened (or tried to open) the folder with Windows Explorer it crashed. Finally I had to format the whole thing.
  2. Create deep structures. I managed to create pure Java code that generated a folder structure in just a few moments. This folder pointed me to a big problem: Once names get longer than 256 characters almost every OS and software will be unable to handle it! I needed hours to find a trick to remove the folder. And YES: This is possible in java so I guess it is using fs API, too.

Maybe I am wrong but please have a look at these facts.
knowingYou #2
Posted 17 March 2012 - 08:59 PM
Workaround for my second point: Check paths for illegal characters and length (parse path to include host's file system).
Casper7526 #3
Posted 17 March 2012 - 10:03 PM
This is why CC should not be on public servers where griefing can occur. You can always make security measures against something, but it's just as easy to find a new way to bypass those said features.
ironsmith123 #4
Posted 18 March 2012 - 07:06 AM
This is why CC should not be on public servers where griefing can occur. You can always make security measures against something, but it's just as easy to find a new way to bypass those said features.
My server was having some lag issues due to tons of computer directories with few computers in actual existence. I just deleted the directories that weren't in use by any computer/turtle I had in game and the lag pretty much went away! Just be careful with who you let on your server, I definitely think you should whitelist it! If you plan on having lots of people on your server chances are your server will get tons of these directories made. Instead of placing programs or files in individual computers, just put them in the programs section of the actual computercraft mod in your server mods folder. Then you can delete the directories on a daily basis without worrying about getting rid of programs and having to put them back in! Have fun!

-Iron
knowingYou #5
Posted 18 March 2012 - 09:43 AM
I did not understand multi-tasking so far but how about fork bombs?
Sebra #6
Posted 18 March 2012 - 10:39 AM
Each CC comp run only one task at any time.
Lua multitasking only switch different tasks one by one.
knowingYou #7
Posted 19 March 2012 - 07:29 PM
How about memory? For example dynamic array indexing?
knowingYou #8
Posted 20 March 2012 - 04:51 PM
bump
knowingYou #9
Posted 22 March 2012 - 02:44 PM
bump
Cloudy #10
Posted 22 March 2012 - 09:12 PM
And bumping helps how? This isn't actually a "virus" - just the fact there are no limits.
bbqroast #11
Posted 25 March 2012 - 02:30 AM
Dear Dan.

Please add the ability to limit the space per computer. Now.
Casper7526 #12
Posted 25 March 2012 - 03:37 AM
Dear user, please know that using CC will never be completely safe for a server and that the server should be for trusted individuals only.
Cloudy #13
Posted 25 March 2012 - 05:36 PM
Also, where do you get off demanding it "now"? This software is provided for free. As such you have no right to demand anything and especially not in an immediate time frame.
Alex_ #14
Posted 25 March 2012 - 08:45 PM
This is why CC should not be on public servers where griefing can occur. You can always make security measures against something, but it's just as easy to find a new way to bypass those said features.
If someone had the CC source code they could make permissions for it.
Cloudy #15
Posted 25 March 2012 - 10:37 PM
This is why CC should not be on public servers where griefing can occur. You can always make security measures against something, but it's just as easy to find a new way to bypass those said features.
If someone had the CC source code they could make permissions for it.

But this isn't going to happen, so I don't see the relevance in your statement.
rockymc #16
Posted 25 March 2012 - 10:39 PM
The only way to fix this "virus" is by adding a program that manipulates and adds a fake HD space.
Advert #17
Posted 26 March 2012 - 02:56 AM
The only way to fix this "virus" is by adding a program that manipulates and adds a fake HD space.
This is incorrect.

You can limit the number of files and their size by wrapping the fs/io api.
1139 #18
Posted 06 April 2012 - 06:43 AM
This is why CC should not be on public servers where griefing can occur. You can always make security measures against something, but it's just as easy to find a new way to bypass those said features.
If someone had the CC source code they could make permissions for it.

But this isn't going to happen, so I don't see the relevance in your statement.

Couldn't you just decompile the classes?
Hawk777 #19
Posted 06 April 2012 - 10:19 AM
The only way to fix this "virus" is by adding a program that manipulates and adds a fake HD space.

Most knowledgeable system administrators would call such a program a disk quota. If anyone runs a server that's likely to be abused, I can't believe they don't already have this set up.
djblocksaway #20
Posted 06 April 2012 - 12:25 PM
hmm its not really a virus if you think about it. . . :)/>/>
Hawk777 #21
Posted 06 April 2012 - 07:54 PM
djblocksaway also makes a good point: the ability to crash a Minecraft server does not a virus make. To be called a virus there must be an element of self-replicating malicious code. This is no more a virus than is downloading a big file on a real computer and then complaining your disk is full.
ComputerCraftFan11 #22
Posted 06 April 2012 - 08:02 PM
Like this?

for i=1,1000 do
  file = io.open(i, "w")
  ---bla bla bla, Im not posting to rest so I don't start making viruses

It makes 1000 files in ur pc
bbqroast #23
Posted 09 April 2012 - 08:01 PM
Dear user, please know that using CC will never be completely safe for a server and that the server should be for trusted individuals only.
These two things wouldn't be to hard to fix.The DIR spamming but would be harder but limiting to hard disk of a computer and parsing the names wouldn't be that hard.
I can deal with griefers easily, proper whitelisting can be done very effectively. Stop denying that any server open to the public is set up to fail (look at all the succesful ones like AG that have hundreds of members). What is anoying is when someone can submit a whitelist app then go onto the server and create a file that is impossible to delete and crashes the entire server.

Out of interest do those file system bugs happen to Linux as well?
Hawk777 #24
Posted 09 April 2012 - 10:42 PM
Linux is well known to handle large numbers of small files in a single directory better than Windows (as a side note, I doubt there were two billion files in your directory; even if each file had only one byte in it, that would likely take up a 4 kB filesystem block, which would eat seven terabytes of disk space). As an example, I tried putting a hundred thousand files in one directory. It only took a few seconds to list the files from a cold cache, less than a second from warm cache, and much less in both cases by leaving off the option to display the files in sorted order. 37 seconds to load the contents of all the files from disk (one byte each) cold cache, half a second warm cache. Five seconds to delete the whole directory, again cold cache.

Filename issues likely won’t happen either; most of the time the OS imposes filename limits (which apply to every program) and all utilities tend to handle files up to those limits.