Bilbao Digital

Asociación para la Cualificación y el Aprendizaje Permanente

  • Full Screen
  • Wide Screen
  • Narrow Screen
  • Increase font size
  • Default font size
  • Decrease font size

bilbaodigital.es

PHP shell upload IV

E-mail Imprimir PDF

video content  The understanding of the systems architecture is essential to analize its security. PHP file upload architecture:

  1. Files are transferred from client filesystem to server RAM.
  2. Apache process will check httpd.conf and php.ini directives.
  3. Once completed, file will be dumped into the server's default temporary directory, unless another location has been given with the upload_tmp_dir directive in php.ini. The temporary directory used for storing files must be writable by apache user.
  4. After a correct transfer, if track_vars is enabled (always since 4.0.3), $_FILES superglobal array is defined (is available in all scopes throughout a script. There is no need to do global $variable; to access it within functions or methods). Only name and type are provided by the user, and therefore tmp_name, error, and size are provided by PHP. The related variables will be initialized as globals if register_globals is enabled (must be desactivated).
  5. The control is given to the php script to move the file to another location. If not, the temp file will be automatically unlinked at the end of the script.

Funcionario

E-mail Imprimir PDF
Debe de existir un talante propio de funcionario; un modo de ser y estar especial y específico capaz de mutarlos, posición ganada, en un grano infectado entre las mismas ingles de la democracia. Lo peor del cuerpo funcionarial estriba en el lugar social que ocupa e infecta; lugares claves para el buen funcionamiento de la sociedad civil: jueces, médicos, maestros, asistentes sociales... ¡El cogollo mismo de la vida ciudadana! No tengo la fórmula para evitar la perplejidad del ciudadano mientras decide si se trata de un caso de corrupción, de simple incapacidad profesional o de pura desidia laboral, o la trinidad a la vez, pero, dado el amplio campo de Internet, alguien debería crear una página donde todos nosotros pudiéramos dar nombre, apellido e información actualizada del juez que se pasa por el forro la Justicia, del médico que se anota pacientes difuntos para cobrar el porcentaje correspondiente, del asistente social que evita el trabajo y papeleo necesarios para evitar la muerte del pequeño Baby P, torturado durante los 17 meses que logró sobrevivir.

La estafa del enseñar a enseñar

E-mail Imprimir PDF

La publicación en EL PAÍS de un Manifiesto Contra el Nuevo Máster de Formación del Profesorado (ECI/3858/2007) ha sido respondida en estas páginas por algunos pedagogos que lo defienden. Las pretendidas evidencias con que argumentan son, sin embargo, falsas. La tesis principal es que un profesor no sólo debe conocer su materia, sino que debe también aprender a enseñarla. Esto parece muy de "sentido común", pero es un sofisma con el que los "expertos en educación" llevan muchos años abduciendo a las autoridades ministeriales. Los futuros profesores, se dice, deben "aprender a enseñar" y los alumnos "aprender a aprender".

PHP shell upload III

E-mail Imprimir PDF

video content  Defense and attack. Client side validation using javascript and actionscript.

The dynamic action attribute of the form tag is received from the swf file depending on the file that is being uploaded. We will decompile it for academic purposes. Disabling javascript we block the information exchange and then, add the right action target by editing the HTML form.

Anyhow, an attacker doesn't need any HTML form to upload a file. It can be done, for example, using a Perl script.

#!/usr/bin/perl
use LWP;
use HTTP::Request::Common;
$ua = $ua = LWP::UserAgent->new;
$res = $ua->request(POST 'http://localhost/demo3/upload3.php',
    Content_Type => 'form-data',
    Content => [userfile => ["basic-shell.php", "basic-shell.php"],],);
print $res->as_string();

This is the bottom line of client side validation.

PHP shell upload II

E-mail Imprimir PDF

video content  Defense and attack. Client side validation using javascript.

(Take a look at the first article for an introduction to file uploading.)

Most security vulnerabilities revolve around the attacker providing bad or malformed data to the server. As buffer overruns, cross-site scripting attacks, SQL injection attacks, and more.

Important

Anything that comes from a connection needs to be treated as untrusted until correct validation. We can consider two kinds of validations. Client side and server side. The former is the starting point for a proper understanding of the input management. Client side validation is insecure by definition. Used for the benefit of the user only, specially, when the user is an attacker ;-).

JPAGE_CURRENT_OF_TOTAL

You are here: Artículos