Attacking Potential of sh-scripts


 
Thread Tools Search this Thread
Special Forums Cybersecurity Attacking Potential of sh-scripts
# 1  
Old 03-28-2011
Attacking Potential of sh-scripts

Hey,

I actually do have a question which seems rather easy for those you know more about this topic, since I am pretty new to bashscripting and don't know where it's limits are I have to ask you guys Smilie

Imagine a system where all possible code execution methods (binary executables or interpreted languages like perl and python) are not possible for the attacker. The only thing he can do is to write and execute shell scripts. But here, he is completly free to do what he wants, but it has to be within a shellscript and not with root rights.

So the question is: How much danger would there be in such a situation? Is it possible to do real harm only using a shellscript? If yes, what kind of stuff can one do? The only thing that came to my mind was deleting files, but as I assume the attacker has only user privilges in this scenario he wouldn't be able to delete the important files.
# 2  
Old 03-28-2011
Theoretically speaking, I believe the greater danger (than deleting data) is the random alteration of data. For instance, if I discovered that I was missing data for 100 people, I could restore a backup copy to determine the missing records and then copy the missing individuals back into a database.
However, something that randomly changed a field in random records would be more difficult to recover. How would I know what data was changed correctly by a user vs. a 'bad script'.
This User Gave Thanks to joeyg For This Post:
# 3  
Old 03-28-2011
Quote:
Originally Posted by disaster
Imagine a system where all possible code execution methods (binary executables or interpreted languages like perl and python) are not possible for the attacker. The only thing he can do is to write and execute shell scripts. But here, he is completly free to do what he wants, but it has to be within a shellscript and not with root rights.
As long as he has access to files, echo -e or printf, and chmod, he has the ability to copy in executables from somewhere else. Not difficult, just tedious. And then they can craft a busybox or wget executable for themselves and build or import anything else they want.
Quote:
So the question is: How much danger would there be in such a situation?
They could download a password-cracking suite and attempt to crack your own system and/or someone else's. I've seen it happen; a "good" piece of cracking software depends on almost nothing in your system except the shell and wget/curl. They won't get in unless your passwords are ridiculous though.

Last edited by Corona688; 03-28-2011 at 11:57 AM..
This User Gave Thanks to Corona688 For This Post:
# 4  
Old 03-28-2011
Thanks for the answer, but you misunderstood me.
I assumed that all form of bringing executable code in the system is not possible (which is done via signature checking in the kernel), except the sh script code (and probably techniques like buffer overflow hacking which I'm also not competent at Smilie)
So basically all the user can do is to execute programs that are already on the system. Changing those in the system will cause them to fail to execute.

Because if I understand you right you mean he would build is own executable by copying it from different locations and/or writing it new. Such executables would be hindered from execution by the kernel
# 5  
Old 03-28-2011
Quote:
Originally Posted by disaster
Thanks for the answer, but you misunderstood me.
I assumed that all form of bringing executable code in the system is not possible (which is done via signature checking in the kernel)
This doesn't mean you shouldn't still think about other vectors.
Quote:
So basically all the user can do is to execute programs that are already on the system. Changing those in the system will cause them to fail to execute.
How do these executables get signed? Any vulnerabilities in that and bam, you might as well have not had it.
Quote:
Because if I understand you right you mean he would build is own executable by copying it from different locations and/or writing it new. Such executables would be hindered from execution by the kernel
Hm.

Which shell? A shell that can make network sockets, like newer bash or newer ksh, could still be used as part of a zombie net.

For that matter, they could just use existing utilities for the most part.
# 6  
Old 03-28-2011
Quote:
Originally Posted by Corona688
This doesn't mean you shouldn't still think about other vectors. How do these executables get signed? Any vulnerabilities in that and bam, you might as well have not had it.
Of course you are right. But this is right now still a rather theoretical question I'm dealing with, where I like to split it up in different parts. One part (the one which I don't have an idea to secure it), is that the attacker can only use shell scripts because all other stuff is already made secure.


As for the verification: I assume a standard RSA digital signature on a message digest . Of course, once the secrect key has been leaked one can do anything.
# 7  
Old 03-28-2011
Hasn't RSA been cracked? ssh uses DSA these days.
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. HP-UX

Potential file system contention on directory

We have an 8-processor Itanium system running HP-UX 11.23 connected to shared SAN discs. We have an application that creates files (about 10) in a specific directory. When the application terminates, these files are removed (unlink) and a few others are updated. The directory contains... (8 Replies)
Discussion started by: FDesrochers
8 Replies

2. AIX

how to handle potential file contention

I need to change how a posting procedure currently works in order to improve load balancing but I am hitting a potential file contention problem that I was wondering if someone here could assist me with... In a directory called FilePool I would have a bunch of files that are constantly coming in... (3 Replies)
Discussion started by: philplasma
3 Replies

3. UNIX for Dummies Questions & Answers

Potential new user of Unix

Hi all, Complete and utter virgin Unix person here (I don't even have the OS yet) As I'm doing a "looking into it" kinda thing before I move from MS I hope my questions are not inappropriate. 1. Should I get some kind off anti virus software. I know Unix is pretty good for not getting them... (2 Replies)
Discussion started by: dhula
2 Replies
Login or Register to Ask a Question