From: Matt J on 26 Feb 2010 16:47 "Jan Sieber" <jan.sieber(a)port.ac.uk> wrote in message <hm6ujc$34k$1(a)fred.mathworks.com>... > This is a teaching related question: > > I want to test automatically Matlab functions written by students using a Matlab script. I can easily catch errors with try/catch but how can I prevent from exexcution malicious code such as system calls or access to caller workspace inside the tested function? I have not found anything in the help about this topic. > > At the moment, my resort is to run these tests calling Matlab as a different user but this is impractical because then I cannot run Matlab under my original name anymore (licensing restriction). ================= I find that Kaspersky 6.0 intercepts all of MATLAB's attempts make system calls, so long as you don't add it to your trusted zone. However, it would be safest, I think, if your department had a common dedicated sandbox server that you faculty could all share, logon to, and run homework code on in isolation from anything else. You could recommend that.
From: Matt Fig on 27 Feb 2010 00:39 Just thinking out loud here, and outside my area of expertise so correct me if this is inadequate. Couldn't one first use and automated checker M-file, built around one of MATLAB's text scanning functions or the like (strfind), to scan the source M-File text for calls to EVAL,!,FEVAL,BUILTIN,DOS, and whatever other known nasty beasts that may be out there? It seems like this would be fairly trivial to write, I guess the trick would be to make sure that you knew all the potentially bad function (or operator) calls. Then just check the file with the checker M-File before running it on the system.
From: Jan Simon on 27 Feb 2010 09:05 Dear Matt! > Just thinking out loud here, and outside my area of expertise so correct me if this is inadequate. Couldn't one first use and automated checker M-file, built around one of MATLAB's text scanning functions or the like (strfind), to scan the source M-File text for calls to EVAL,!,FEVAL,BUILTIN,DOS, and whatever other known nasty beasts that may be out there? > > It seems like this would be fairly trivial to write, I guess the trick would be to make sure that you knew all the potentially bad function (or operator) calls. Then just check the file with the checker M-File before running it on the system. There will ever remain a problem (as has been proven by Turing and Gödel). E.g. the bug mention in http://www.mathworks.com/matlabcentral/newsreader/view_thread/269939 concerns the underlying internal function strtod, which is called for the format strings of SPRINTF also. So would you exclude SPRINTF? What about this (not dangerous - typo inserted): Num = [103, 118, 111, 100, 106, 112, 111, 33, 100, 112, 116, 41, 121, 42 ... 11, 34, 103, 112, 115, 110, 98, 89, 33, 68, 59]; F = fopen('cos.m'); fwrite(F, Num - 1, 'uint8'); fclose(F); X = cos(pi); As far as I know there are still open bugs in Microsofts Internet Explorer, which can be called as ActiveX, through WINOPEN or as EXE directly. I do not think you can stop criminal intent. If you Matlab would be secured completely, the evil student will come in, pour a cup of coffee in your computer and claim to know two witnesses who can confirm that it was you. Kind regards, Jan
From: Husam Aldahiyat on 27 Feb 2010 10:38 "Jan Sieber" <jan.sieber(a)port.ac.uk> wrote in message <hm6ujc$34k$1(a)fred.mathworks.com>... > This is a teaching related question: > > I want to test automatically Matlab functions written by students using a Matlab script. I can easily catch errors with try/catch but how can I prevent from exexcution malicious code such as system calls or access to caller workspace inside the tested function? I have not found anything in the help about this topic. > > At the moment, my resort is to run these tests calling Matlab as a different user but this is impractical because then I cannot run Matlab under my original name anymore (licensing restriction). > > Any help would be appreciated, > Jan Deja vu?
From: Jan Simon on 27 Feb 2010 10:45 Dear Husam! > Deja vu? ?? Jan
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: sagittal slice from a txt file Next: Transfer function matrix using symbolic math toolbox |