Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Completely removing a perl function.

by Moron (Curate)
on Jun 28, 2006 at 14:37 UTC ( [id://558030]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Completely removing a perl function.
in thread Completely removing a perl function.

I can't prove my theory that to every measure there exists a countermeasure - it would be an infite proof. But I am sure the same principles of non-100% security will apply to Safe - it is a matter of creative thinking. The first two ideas that come to mind (that a hacker might try to compromise Safe.pm):

- download and modify the source and use a modified version of Safe.pm

- change its code or access to it in a BEGIN block

I am sure others can think up more.

-M

Free your mind

Replies are listed 'Best First'.
Re^4: Completely removing a perl function.
by Anonymous Monk on Jun 28, 2006 at 18:08 UTC
    There are lots of measures which don't allow countermeasures. If there weren't, any attempt to secure a system would be pointless. As the system gets more more complex, it becomes harder, but not impossible, to ensure that there are no countermeasures for any of the features that comprise the system, while still allowing legitimate access to people who need it. Removing a given feature outright is usually not that difficult.

    For example, removing the feature (shmget), plus all the general system interfaces, ( let's start by eliminating syscall(), system(), backquotes and XS bindings from the secure version of the language), and taking it out of the perl binary itself would be essentially unbreakable.

    If you can't make a system call, and the system call is the only interface to features protected by the O/S, then you can't tamper with those features, period.

    You can write all the code you want, but if you can't bypass the control mechanisms, you're out of luck.

    For example, there's no way to directly write to a specific memory address in Perl (without using XS). So, if a hack relies on tampering with perl source code to access a specific memory address, it will always fail. That's an example of a language specific feature that's not circumventable.

      For example, there's no way to directly write to a specific memory address in Perl (without using XS).
      I think you mean to say that there's no supported way to write to a specific memory address in Perl. There are many unsupported methods to do so.
        Those are bugs in perl. They're not there by design, they're not supposed to be there, and if the implementation was correct, they wouldn't be there.
      I already pointed out that C would be used at some point in this escalating battle for control of a Perl implementation. And if C were controlled, the hacker has assembler and then raw machine code waiting in the line-up - there is no answer to that.

      -M

      Free your mind

        I already pointed out that C would be used at some point in this escalating battle for control of a Perl implementation. And if C were controlled, the hacker has assembler and then raw machine code waiting in the line-up - there is no answer to that.

        The answer is: don't let him do that sort of thing in the first place! Why does some random hacker have access to upload and run assembly language code on your machine, and why doesn't the operating system and/or hardware stop him when he tries to execute instructions for which he has no permissions?

        If someone only needs to execute perl, then only give him access to upload and run perl. Don't let him run C. code, assembly language code, or any other binary code! Make his nly option to execute perl on any of the files which he has uploaded: and reject any perl script which contains calls to system, backquotes, or XS (preferably, by taking support for those features out of the binary in the first place).

        Tamper-proof systems are fundamentally possible. Here's a simple example. Suppose I want to prevent hackers from remotely accessing my files. I just ensure that the network cable is unplugged whenever I slot in the flash RAM card that holds my private files is installed, and that I take the memory card out of my computer before I plug the network cable back in. No matter how clever the hacker is, and no matter how much assembly language he knows, he can't defeat physics.

        He also can't defeat logic. If my operating system always checks the op-codes of all user space programs, and correctly rejects programs that try to read beyond their allocated address space, my program *can't* access another program's data, whether my program was originally written in perl, C., assembly, or Intercal. The O/S will intercept the attempt, and terminate the program before it can do any harm.

        If the O/S also zeros out all memory in the data segments allocated to userspace programs, then my program can't read leftover data from old programs, because it simply doesn't exist.

        The only time a hacker has an opportunity to cause mischief is when the implementor in charge of security screws up; and he can only exploit that mistake to the extent of the screw up. Hackers can't work magic out of thin air, and in absence of mistakes to exploit, they can't do anything.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://558030]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-03-28 10:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found