!c99Shell v. 1.0 pre-release build #16!

Software: Apache/2.2.3 (CentOS). PHP/5.1.6 

uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44
EDT 2010 i686
 

uid=48(apache) gid=48(apache) groups=48(apache) 

Safe-mode: OFF (not secure)

/usr/libexec/webmin/postgresql/   drwxr-xr-x
Free 50.93 GB of 127.8 GB (39.85%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     save_group.cgi (2.63 KB)      -rwxr-xr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
#!/usr/bin/perl
# save_group.cgi
# Create, update or delete a postgres group

require './postgresql-lib.pl';
&ReadParse();
$access{'users'} || &error($text{'group_ecannot'});
&error_setup($text{'group_err'});

if ($in{'delete'}) {
    # just delete the group
    if (&get_postgresql_version() >= 8.0) {
        &execute_sql_logged($config{'basedb'}, "drop group $in{'oldname'}");
        }
    else {
        &execute_sql_logged($config{'basedb'}, "delete from pg_group where grosysid = $in{'gid'}");
        }
    &webmin_log("delete", "group", $in{'name'});
    }
else {
    # parse inputs
    $in{'name'} =~ /^\S+$/ || &error($text{'group_ename'});
    $s = &execute_sql($config{'basedb'}, "select * from pg_group where groname = '$in{'name'}'");
    $in{'gid'} =~ /^\d+$/ || &error($text{'group_egid'});
    if ($in{'new'}) {
        $s->{'data'}->[0]->[0] && &error($text{'group_etaken'});
        }
    else {
        $s->{'data'}->[0]->[0] && $s->{'data'}->[0]->[1] != $in{'gid'} && &error($text{'group_etaken'});
        }

    # Actually create or update the group
    if (&get_postgresql_version() >= 8.0) {
        # Need to use new create group or modify command
        $s = &execute_sql($config{'basedb'}, "select $pg_shadow_cols from pg_shadow");
        foreach $u (@{$s->{'data'}}) {
            $umap{$u->[1]} = $u->[0];
            }
        @mems = split(/\r?\n/, $in{'mems'});
        if ($in{'new'}) {
            $first = shift(@mems);
            &execute_sql_logged($config{'basedb'}, "create group $in{'name'} sysid $in{'gid'} user ".$umap{$first});
            if (@mems) {
                &execute_sql_logged($config{'basedb'}, "alter group $in{'name'} add user ".join(" , ", map { $umap{$_} } @mems));
                }
            }
        else {
            if ($in{'name'} ne $in{'oldname'}) {
                # Rename first
                &execute_sql_logged($config{'basedb'}, "alter group $in{'oldname'} rename to $in{'name'}");
                }
            $s = &execute_sql($config{'basedb'}, "select * from pg_group where groname = '$in{'name'}'");
            @oldmems = &split_array($s->{'data'}->[0]->[2]);
            if (@oldmems && $oldmems[0] ne '') {
                &execute_sql_logged($config{'basedb'}, "alter group $in{'name'} drop user ".join(", ", map { $umap{$_} } @oldmems));
                }
            if (@mems) {
                &execute_sql_logged($config{'basedb'}, "alter group $in{'name'} add user ".join(" , ", map { $umap{$_} } @mems));
                }
            }
        }
    else {
        # Can update group table directly
        $mems = &join_array(split(/\0/, $in{'mems'}));
        if ($in{'new'}) {
            &execute_sql_logged($config{'basedb'}, "insert into pg_group values ('$in{'name'}', '$in{'gid'}', '$mems')");
            }
        else {
            &execute_sql_logged($config{'basedb'}, "update pg_group set groname = '$in{'name'}', grolist = '$mems' where grosysid = $in{'gid'}");
            }
        }
    &webmin_log($in{'new'} ? "create" : "modify", "group", $in{'name'});
    }
&redirect("list_groups.cgi");


:: Command execute ::

Enter:
 
Select:
 

:: Shadow's tricks :D ::

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

:: Preddy's tricks :D ::

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0072 ]--