Slashdot Mirror


User: Gunstick

Gunstick's activity in the archive.

Stories
0
Comments
403
First seen
Last seen
Profile
(view on slashdot.org)

Comments · 403

  1. Re:shell is more secure than perl on Programming Things I Wish I Knew Earlier · · Score: 1

    Sorry, too much hassle to do quoting correctly here :-)

    test.sh '';rm -rf /#'

    Have you tried this?
    This is not even passing the parameter to the test.sh and would barf your system as well if you use an equivalent test.pl
    So please try your claims before using them in arguments.

    There is no real exec call in shell. Even using the exec instruction explicitely, you won't execute parameters.

    > call a shell script from something which is not a shell

    Maybe you you meant the reverse?
    Anyway, in shell you call stuff which is not a shell from the shell. And this works wery well even when you're ignoring security concerns.
    If you don't use CPAN, you will call the shell from perl. At least that's what most users do: system()
    I recently directed someone to use CPAN to get his work done, and the resulting perl was just an accumulation of various calls to other utilities. And we paid for that guy!
    Injections galore! Transforming the perl into simple shell (what it in effect is) and the injetions are gone.
    Other possibility is of course use all the fancy stuff from CPAN to do the job.

    But why is everybody using system()? What is wrong with exec()?
    And then you have the usage of `` inside perl which I come across quite often.

    Perl has way too many places where you can build bad code.
    shell has just a few.

    > Erm... If $command is constructed insecurely, you have precisely the same problem in the shell as in Perl.
    No it's not.
    Let's make an insecure command (mind the usage of single quotes, else the example is futile):

    command='cat file;$(ls > list)'
    $command

    cat: file;$(ls: No such file or directory
    cat: >: No such file or directory
    cat: list): No such file or directory

    Oh dang! It did not do what you thought.

    > In other words, you're still allowing the user to pass arbitrary parameters to convert, which is still a bug.
    does it corrupt the system, well no. yes it's a bug (bad coding style, oh that statement I know as well from the perl world).

    > And the solution is trivial -- use sysopen, no sanitizing needed.
    which should indeed be the default, screw the open call, it's bringing problems. wizards should use open, beginners use sysopen. But in the real world it's the reverse.

    > TFA is suggesting we call "convert" from whatever we wrote our web service in, while I'm suggesting we use native bindings.
    In this I'm OK with you, if someone wants to call convert instead of a binding, he should write the webservice in a language meant to be used to call convert, and that's shell. Else he should use a language which has imagemagick bindings or don't do it at all.

    Georges

  2. Re:shell is more secure than perl on Programming Things I Wish I Knew Earlier · · Score: 1

    It starts to become pointless to discuss with you. Come on...

    echo `rm *`

    is NOT the same as

    test.sh '`rm *`'

    If you don't believe me, do first your tests.

    Also arguing that convert may or may not have unexpected behaviour does not differ if you use perl or bash to call it. We discuss the problematic of perl ADDING insecurity compared to shell.
    Because if you have that `rm *` parameter in the perl program, you will actually execute it, but not in shell!

    The equivalent perl construct written in shell is:

    eval $command

    You never do that in shell, as

    $command

    works as well. And then you are safe.
    If you have read my previous post, I *did* execute it with spaces. Rememver the

    test.sh "; rm -rf /; #"

    It did not execute anything. Just convert did not know anything about the -r parameter. In perl it will have executed. Sanitizing needed for `, and for $ and for | and for > and, and, and. The list of problematic characters is long. I once tried to call convert with allowing to pass some convert parameters by the user too. To do it safely, it was a huge headache. So I resorted to only allowing very specific parameters.

    In shell, as well as in perl, you need to know convert's parameter list. Either kill any - in the parameters or simply pattern match away the specific option which makes convert dangerous (I did not find any, looked for writing a file). But (repeating myself) in shell you do not need to know anything about something else (`$|>...) which has nothing to do with convert.

    More specific case: awk
    That's probably the closest you can get to inadvertently execute code (yeah I help you there in your arguing ...).

    calling awk with

    awk '/pattern/ {print '$variable'}' is bad

    but this is like you should do it and it is safe

    awk -v variable="$variable" '{/pattern/ {print variable}'

    Georges

  3. Re:shell is more secure than perl on Programming Things I Wish I Knew Earlier · · Score: 1

    you can much more easily inject natsy things into perl or php than into shell.

    Erm... how so?

    Give the perl script the following filename to open: "|rm *"

    Have you ever seen a shell executing data?

    Uhm... yes? That's what they do. Ever heard of a shell script?

    No shells execute shellcode, like perl executes perl code. Shells don't execute their parameters. Perl does (see above). Give a shell "|rm *" and it will just try to open the file "./rm *" Give it "$(rm *)" and still it's just complaining with $(rm: file not found and *): file not found. Or if the script is well written it barfs with $(rm *): file not found. Nothing is executed.

    I would need to call "sh" or "eval" to make this work.

    So imagine a hypothetical script in which you do something like this stupid little example:

    my $cmdline = "convert $x.svg $x.png";
    system($cmdline);

    And in this case, $x is user input. Well, now you're screwed if anyone enters spaces, so you do this:

    my $cmdline = "convert '$x.svg' $x.png'";

    Now you've got a classic SQL-injection-style vulnerability. What happens if a user sets $x to "'; rm -rf /; #"? That could be more devastating than a traditional SQL injection vulnerability.

    So how, exactly, is Perl more vulnerable than that?

    The problem with your example is the in shell you do not need to use the clumsy "commandline=:..." construct. It rather looks like this:

    #!/bin/bash
    x="$1"
    convert $x.svg $x.png"

    You can't "hack" that.

    Or let's see with the ugly command in a variable method:

    #!/bin/bash
    x="$1"
    cmdline="convert $x.svg $x.png"
    $cmdline

    test run:

    # test.sh "; rm -rf /; #"
    convert: unable to open image `;': No such file or directory @ blob.c/OpenBlob/2439.
    convert: unable to open image `rm': No such file or directory @ blob.c/OpenBlob/2439.
    convert: unrecognized option `-rf' @ convert.c/ConvertImageCommand/2177.

    On the other side, is perl which calls without you knowing "sh" on simple things as opening a file.

    Sorry, I have to call bullshit on this. Here's the perldoc on 'open'. It tells you exactly under which circumstances the filename will be interpreted as a command. If you don't want to sanitize a pipe character from the beginning and end of your string, there's always sysopen, which is mapped directly to fopen -- if this is vulnerable, then every single program on your system is vulnerable.

    If you can't be bothered to RTFM, what business do you have programming?

    And again, how is this more vulnerable than the point at which you call the shell from a perl script?

    With shell you don't need to read any manual or sanitize fancy characters. You just write your program. If perl would have been programmed with security in mind, the default (i.e. empty mode) would have been a forced '<' and if you want to call a program, you should need to make it '<|' or '>|' or anything funky like that. But no, it's too user friendly and the many scripts around who read files with "open MyFile,$filename;" are a common occurance.

    A random search skipping the links from perl.org brings up quickly a first instruction example how to read a file. http://www.pageresource.com/cgirec/ptut14.htm See, no '<' here, and so beginners immediately write bad code. Irony is that this is even a webpage for how to write CGI scripts.

    And we don't talk about my programming business but the thousands

  4. Re:This is te problem with Linux on Programming Things I Wish I Knew Earlier · · Score: 1

    site:ubuntuforums.org term1 term2

    Why they insist of not simply putting a google search link on the forums is a mystery to me.

  5. shell is more secure than perl on Programming Things I Wish I Knew Earlier · · Score: 1

    yes

    you can much more easily inject natsy things into perl or php than into shell.
    Have you ever seen a shell executing data? I would need to call "sh" or "eval" to make this work.
    On the other side, is perl which calls without you knowing "sh" on simple things as opening a file.

    So sorry, perl is more prone to injections as shell.
    Georges

  6. Re:739 Gb/sq.in. on The Limits To Perpendicular Recording · · Score: 1

    I don't know if "library of congress" is a surface measure. I only know football fields. But maybe someone knows the size of the Library of Congress in terms of football fields so we could make the conversion.

  7. can I also have update for my Sony LCD tv? on PS3 To Gain Support For 3-D Movies On Blu-Ray and YouTube · · Score: 1

    Hey so I only have to update the PS3, the sony TV (Just one year old, come on!, and it is the top of the line model too!) and buy a couple of glasses.
    Do you have this as a bundle?

    Oh, this is classified in the "will never happen" section?

  8. no copied comments on Claimed Proof That UNIX Code Was Copied Into Linux · · Score: 1

    As long as the comments going with the code are not copied verbatim, I don't really see an issue.

  9. It's already in use and does not work on Google's New Scheme To Avoid Unlicensed Music · · Score: 2, Interesting

    I used my video camera to film a circus performance. The video was disabled because the sound from the loudspeakers was on my video and that sound was copyrighted music.
    At the same time, the same music title was spread around youtube in full glory with accompanying original video clip in dozens of copies and was not blocked. Why is my analog recording blocked and the digital 1:1 copies are not?

    Faire use, my ass!

  10. German's Federal Minister of Defence: 15 words on Falsehoods Programmers Believe About Names · · Score: 1

    is called "Karl Theodor Maria Nikolaus Johann Jacob Philipp Franz Joseph Sylvester Freiherr von und zu Guttenberg"
    http://en.wikipedia.org/wiki/Karl-Theodor_zu_Guttenberg

    I tried to post that to the comments of TFA but it does not work.

  11. Re:HDMI jack? on Sprint Unveils HTC Evo 4G Super Phone · · Score: 1

    you can actually run audi and video over DVI. At least that's what my dreambox does over the DVI to HDMI cable. Seems the box simply puts the HDMI signal onto the DVI plug. Probably to not have to pay HDMI licensing costs.

  12. Re:Not impressive on Lego Robot Solves Any Rubik's Cube In 12 Seconds · · Score: 2, Funny

    in fact the Rubics Cube being a *cube* one could simply say "a 3".

  13. Re:Dealing w/ something similar at work on Time Bomb May Have Destroyed 800 Norfolk City PCs' Data · · Score: 1

    roaming profiles are the worst way of a solution to this problem. Ever have to wait like 20 minutes to log in just because MSIE puts it's huge webcache into the profile. Oh no no...
    Profiles are great, but don't do them the "roaming" way, because that's the rowing way.

  14. Re:Car analogies! on Toyota Pedal Issue Highlights Move To Electronics · · Score: 1

    yes, it's like you stop typing on your keyboard and there are still characters diplayed on screen.

  15. Re:Well, duh on Mum's the Word On Google Attack At Davos · · Score: 1

    they are NOT my friends!

    And I don't need them to poinson my Kids with dangerous toys.

  16. they destroy our climate, now they destroy ... on Mum's the Word On Google Attack At Davos · · Score: 1

    YES
    it was china who made fail Kopenhagen conference! They simply said no to everything. Really everything. Even to proposals like that Europe does even more CO2 reduction than planned. No, no ,nonono, no and no.
    Bloody hell. Just skrew them!

  17. Re:idiocy? Incompetence? on Y2.01K · · Score: 1

    if the code had been fixed in 1999 using reverse engineering, the developer should have seen that the field says 99 and not 63
    So if 99 means 1999 then that 99 must be BCD.
    If of course the developer has never heard of what BCD is (most high level languages do not have that concept and today you only learn this stuff at school) then it's no suprise that he passed over this $99 representing 1999. Never questioning why he has to modify the code as $99+1=$9A and that would be fine for 2000...

    On another note, some programs were indeed fixed like that. The BCD field, in 1999 was defined as hexadecimal number of years since 1846 ... This works fine until 2102

  18. Re:turn your usb drive into a NAS on Best Filesystem For External Back-Up Drives? · · Score: 1

    I plan doing this in software for my mobile disk.
    Have a small FAT, holding a vmware image and a player for mac (really soon now), win and linux.
    The second big partition is ext3 in a truecrypt container (mobile disk...).
    The image contains soft for doing nfs, smb and other accesses to the truecrypt container.

    So plug the disk into any machine and start the vmware player: voila there's your data.

  19. Re:Solaris? Give me a break. on The Best, Worst, and Ugliest OSes of the Decade · · Score: 1

    yes, solaris is horrible. It's only useful for install-and-forget. Never patch or upgrade. It's just plain simply impossible.
    If you want a package manager style update and patching system from a professional (means those big box mover guys) vendor go with HP-UX and AIX. *never* solaris.
    Or you can still stick with a serious linux distro.

    Windows? Forget it. "you need soft MS-xy for this feature". OK, I install that. Start... "you need .NET frameork for soft MS-xy to work". Come on! Where are the dependencies and repository features in windows? And this is in freaking win2008 for 100% MS only products.

  20. just don't route it! on Malware and Botnet Operators Going ISP · · Score: 1

    Delete the AS from the routing tables and don't peer with them.

  21. Re:Not a new feature but new in a big DE, I think on Will Tabbed Windows Be the Next Big Thing? · · Score: 1

    well it's all nice but I don't like clicking every time I want to chenge application. Better have them in separate windows.
    So it would be rather better to have tabbed desktops, or just plain simple desktops. Oh we already have that :-)

    What I really like is focus follows mouse without automatic window raising. That's my most effective working setup.

  22. will never happen in EU because it's not offered! on Linux Reaches 32% Netbook Market Share · · Score: 1

    There are no more linux based netbooks available in european shops.

    Microsoft has won!

  23. USB host and peripheral in same device on Building the Dream Google Smartbook · · Score: 1

    Why can't I connect a USB harddisk to my phone?
    Why can't I connect my netbook as harddisk to my PC? (ok, file share may work, but it's more cumbersome than just plug the USB cable)

    So what I would like is a device which can act as a usb storage but at the same time also accept other usb storage devices connected to it.
    Thanks for USB to be an assymetic protocol, why didn't they do it like firewire in the first place?

  24. Re:Pagers were working? on Wikileaks Publishes 500,000 9/11 Pager Messages · · Score: 1

    nice to mention your email which is linked to that slashdot story. But...

    "Object not found!

    The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

    If you think this is a server error, please contact the webmaster.
    Error 404
    www.tribrothers.com
    Thu Nov 26 02:52:31 2009
    Apache/2.0.54 (Linux/SUSE) "

    Well, so far for "the Internet never forgets anything"

  25. are browsers without cookie managers now illegal? on "Breathtakingly Stupid" EU Cookie Law Passes · · Score: 1

    are browsers without cookie managers now illegal?
    No probably not

    but the text says that "consent" is implicitly given by the user if he uses a cookie manager.

    "the user's consent to processing may be expressed by using the appropriate settings of a browser or other application"