[ Avaa Bypassed ]




Upload:

Command:

www-data@3.149.253.148: ~ $
#!/usr/bin/perl

require './filemin-lib.pl';
use Cwd 'abs_path';

&ReadParse(\%in, "GET");

get_paths();

my @errors;
my @uploaded_files;
my $uploaded_dir;
$line = "";

# Use Webmin's callback function to track progress
$cbfunc = \&read_parse_mime_callback;

# Get multipart form boundary
$ENV{'CONTENT_TYPE'} =~ /boundary=(.*)$/ || &error($text{'readparse_enc'});
$boundary = $1;

# Initialize progress tracker
&$cbfunc(0, $ENV{'CONTENT_LENGTH'}, undef, $in{'id'});

#Read the data
MAINLOOP: while(index($line,"$boundary--") == -1) {
	# Reset vars on each loop
	$file = undef;
	$rest = undef;
	$prevline = undef;
	$header = undef;
	$line = <STDIN>;
	$got += length($line);
	if ($upload_max && $got > $upload_max) {
		&error(&text('error_upload_emax', &nice_size($upload_max)));
		}
  	&$cbfunc($got, $ENV{'CONTENT_LENGTH'}, undef, $in{'id'});
	if ($line =~ /(\S+):\s*form-data(.*)$/) {
		$rest = $2; # We found form data definition, let`s check it
		}
	else {
		next;
		}

	# Check if current form data part is file
	while ($rest =~ /([a-zA-Z]*)=\"([^\"]*)\"(.*)/) {
		if ($1 eq 'filename') {
			$file = $2;
			}
		$rest = $3;
		}
    
	if (defined($file)) {
		my @st = stat($cwd);
		# If we have a dir, parse it and create a sub-tree first
		if ($file =~ /\//) {
			my ($dir) = $file =~ /^(.*)\/[^\/]+$/;
			if ($dir) {
				my @dirs = split('/', $dir);
				$dir = '/';
				# If overwriting is not allowed check for dupes
				if (!$in{'overwrite_existing'}) {
					if ($dirs[0] && -e "$cwd/$dirs[0]") {
						# As only one directory upload at a time allowed
						# check if parent exists and if it does add
						# predictable suffix, like `dir(1)` or `dir(2)`
						if (!$uploaded_dir) {
							my $__ = 1;
							for (;;) {
							    my $new_dir_name = "$dirs[0](" . $__++ . ")";
							    if (!-e "$cwd/$new_dir_name") {
									$uploaded_dir = $new_dir_name;
							        last;
							    	}
								}
							}
						}
					else {
						$uploaded_dir = $dirs[0];
						}
					$file =~ s/^(\Q$dirs[0]\E)/$uploaded_dir/;
					$dirs[0] = $uploaded_dir;
				}
				foreach my $updir (@dirs) {
					$dir .= "$updir/";
					if (!-e "$cwd$dir") {
						mkdir("$cwd$dir");
						&set_ownership_permissions($st[4], $st[5], undef, "$cwd$dir");
						}
					}
				}
			}
		# In case of a regular file check for dupes
		if (!$in{'overwrite_existing'}) {
			if ($file && -e "$cwd/$file") {
				# If file exists add predictable suffix, like `file(1)` or `file(2)`
				my ($file_name, $file_extension) = $file =~ /(?|(.*)\.((?|tar|wbm|wbt)\..*)|(.*)\.([a-zA-Z]+\.(?|gpg|pgp))|(.*)\.(?=(.*))|(.*)())/;
				$file_extension  = ".$file_extension" if ($file_extension);
				my $__ = 1;
				for (;;) {
					my $new_file_name = "$file_name(" . $__++ . ")";
					if (!-e "$cwd/$new_file_name$file_extension") {
						$file = "$new_file_name$file_extension";
						last;
						}
					}
				}
			}

		# OK, we have a file, let`s save it
		my $full = "$cwd/$file";
		my $newfile = !-e $full;
		if (!open(OUTFILE, ">$full")) {
			push @errors, "$text{'error_opening_file_for_writing'} $path/$file - $!";
			next;        
			}
		else {
			binmode(OUTFILE);
			if ($newfile) {
				# Copy ownership from parent dir
				&set_ownership_permissions($st[4], $st[5], undef, $full);
				}
			# Skip "content-type" as we work in binmode anyway and
			# skip empty line
			<STDIN>;
			<STDIN>;

			# Read all lines until next boundary or form data end
			while(1) {
				$line = <STDIN>;
				if (!defined($line)) {
			    		push @errors, "Unexpected end of input";
					last MAINLOOP;
			        }
			        # Inform progress tracker about our actions
			      	$got += length($line);
		      		&$cbfunc($got, $ENV{'CONTENT_LENGTH'}, $file, $in{'id'});

			      	# Some brainf###ing to deal with last CRLF
              			if (index($line,"$boundary") != -1 ||
				    index($line,"$boundary--") != -1) {
			  		chop($prevline);
			  		chop($prevline);
                  			if (!print OUTFILE $prevline) {
                      				push @errors, "text{'error_writing_file'} $path/$file";
		      				last MAINLOOP;
                  				}
					last;
					}
				else {
                  			if (!print OUTFILE $prevline) {
						push @errors, "text{'error_writing_file'} $path/$file";
				      		last MAINLOOP;
						}
					$prevline = $line;
					}
				}

          		# File saved, let`s go further
          		close(OUTFILE);

          		# Store which file were uploaded
          		my $fpath = $cwd;
          		my $ffile = $file;
          		my @subdirs = split('/', $ffile);
          		if (@subdirs > 1) {
          			$ffile = pop(@subdirs);
          			$fpath .= ("/" . join('/', @subdirs));
          			}
          		push(@uploaded_files, {'path' => $fpath, 'file' => $ffile});
      			}
		}
	else {
		# Just skip everything until next boundary or form end
		while (index($line, "$boundary") == -1 ||
		       index($line, "$boundary--") == -1) {
			$line = <STDIN>;
			}        
		}
	}

# Extract and delete uploaded files
if ($in{'extract_uploaded'}) {
	my @eerrors = &extract_files(\@uploaded_files, 1);
	@errors = (@eerrors, @errors)
		if (@eerrors);
	}

# Everything finished, inform progress tracker
&$cbfunc(-1, $ENV{'CONTENT_LENGTH'}, undef, $in{'id'});
if (scalar(@errors) > 0) {
	print_errors(@errors);
	}
else {
	&redirect("index.cgi?path=".&urlize($path));
	}

Filemanager

Name Type Size Permission Actions
images Folder 0755
lang Folder 0755
unauthenticated Folder 0755
CHANGELOG File 9.22 KB 0644
acl_security.pl File 2.26 KB 0644
bookmark.cgi File 326 B 0755
chattr.cgi File 1007 B 0755
chcon.cgi File 979 B 0755
chmod.cgi File 2.42 KB 0755
chown.cgi File 983 B 0755
compress.cgi File 750 B 0755
config File 20 B 0644
config.cgi File 2.27 KB 0755
config.info File 172 B 0644
config.info.ar File 97 B 0644
config.info.ca File 52 B 0644
config.info.de File 61 B 0644
config.info.fr File 60 B 0644
config.info.it File 199 B 0644
copy.cgi File 362 B 0755
create_file.cgi File 559 B 0755
create_folder.cgi File 550 B 0755
cut.cgi File 361 B 0755
defaultacl File 373 B 0644
defaultuconf File 124 B 0644
delete.cgi File 352 B 0755
download.cgi File 799 B 0755
edit_file.cgi File 1.77 KB 0755
extract.cgi File 1.49 KB 0755
filemin-lib.pl File 23.78 KB 0644
http_download.cgi File 1.34 KB 0755
index.cgi File 3.29 KB 0755
module.info File 137 B 0644
module.info.af File 0 B 0644
module.info.af.auto File 112 B 0644
module.info.ar File 116 B 0644
module.info.ar.auto File 32 B 0644
module.info.be File 0 B 0644
module.info.be.auto File 137 B 0644
module.info.bg File 0 B 0644
module.info.bg.auto File 164 B 0644
module.info.ca File 89 B 0644
module.info.ca.auto File 24 B 0644
module.info.cs File 0 B 0644
module.info.cs.auto File 115 B 0644
module.info.da File 0 B 0644
module.info.da.auto File 101 B 0644
module.info.de File 88 B 0644
module.info.de.auto File 21 B 0644
module.info.el File 0 B 0644
module.info.el.auto File 209 B 0644
module.info.es File 0 B 0644
module.info.es.auto File 140 B 0644
module.info.eu File 0 B 0644
module.info.eu.auto File 131 B 0644
module.info.fa File 0 B 0644
module.info.fa.auto File 137 B 0644
module.info.fi File 0 B 0644
module.info.fi.auto File 110 B 0644
module.info.fr File 0 B 0644
module.info.fr.auto File 136 B 0644
module.info.he File 0 B 0644
module.info.he.auto File 125 B 0644
module.info.hr File 0 B 0644
module.info.hr.auto File 118 B 0644
module.info.hu File 0 B 0644
module.info.hu.auto File 109 B 0644
module.info.it File 104 B 0644
module.info.ja File 0 B 0644
module.info.ja.auto File 137 B 0644
module.info.ko File 0 B 0644
module.info.ko.auto File 118 B 0644
module.info.lt File 0 B 0644
module.info.lt.auto File 122 B 0644
module.info.lv File 0 B 0644
module.info.lv.auto File 125 B 0644
module.info.ms File 0 B 0644
module.info.ms.auto File 113 B 0644
module.info.mt File 0 B 0644
module.info.mt.auto File 120 B 0644
module.info.nl File 0 B 0644
module.info.nl.auto File 108 B 0644
module.info.no File 22 B 0644
module.info.no.auto File 75 B 0644
module.info.pl File 0 B 0644
module.info.pl.auto File 115 B 0644
module.info.pt File 0 B 0644
module.info.pt.auto File 133 B 0644
module.info.pt_BR File 0 B 0644
module.info.pt_BR.auto File 142 B 0644
module.info.ro File 0 B 0644
module.info.ro.auto File 120 B 0644
module.info.ru File 0 B 0644
module.info.ru.auto File 194 B 0644
module.info.sk File 0 B 0644
module.info.sk.auto File 126 B 0644
module.info.sl File 0 B 0644
module.info.sl.auto File 118 B 0644
module.info.sv File 0 B 0644
module.info.sv.auto File 99 B 0644
module.info.th File 0 B 0644
module.info.th.auto File 228 B 0644
module.info.tr File 0 B 0644
module.info.tr.auto File 121 B 0644
module.info.uk File 0 B 0644
module.info.uk.auto File 188 B 0644
module.info.ur File 0 B 0644
module.info.ur.auto File 145 B 0644
module.info.vi File 0 B 0644
module.info.vi.auto File 139 B 0644
module.info.zh File 0 B 0644
module.info.zh.auto File 101 B 0644
module.info.zh_TW File 0 B 0644
module.info.zh_TW.auto File 110 B 0644
paste.cgi File 1.23 KB 0755
prefs.info File 10 B 0644
rename.cgi File 431 B 0755
safeacl File 50 B 0644
save_config.cgi File 858 B 0755
save_file.cgi File 705 B 0755
search.cgi File 572 B 0755
setfacl.cgi File 1.66 KB 0755
upload.cgi File 5.23 KB 0755