// Check if uploads directory exists, create if not if (!is_dir($target_dir)) { mkdir($target_dir, 0777, true); }
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo"The file ". htmlspecialchars( basename( $_FILES["fileToUpload"]["name"])). " has been uploaded to " . $target_file; } else { echo"Sorry, there was an error uploading your file."; } ?>
Dockerfile.target1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
FROM ubuntu:latest ARG DEBIAN_FRONTEND=noninteractive RUN apt update && apt install -y nginx openssh-server redis-server iproute2 net-tools mysql-client iputils-ping php-fpm php-cli && \ rm -rf /var/lib/apt/lists/* RUN which ping || (echo "错误:ping 命令未找到,安装失败!" && exit 1) RUN mkdir -p /var/www/html/uploads && chown -R www-data:www-data /var/www/html COPY nginx_vhost_target1.conf /etc/nginx/sites-available/default RUN rm /etc/nginx/sites-enabled/default && ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/ COPY internal_dashboard.html /var/www/html/index.html COPY target1_phpinfo.php /var/www/html/phpinfo.php EXPOSE 80 EXPOSE 22 EXPOSE 6379 RUN useradd -m appuser && echo "appuser:securepassword" | chpasswd CMD service nginx start && service php$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')-fpm start && service ssh start && service redis-server start && tail -f /dev/null
<h2>Accessible Internal Services (Via this host or connected systems)</h2> <ulclass="service-list"> <li> <strong>Internal Web Application:</strong><ahref="http://172.20.0.10:80/">http://172.20.0.10/</a> (This server) <br>Includes sample pages like <ahref="http://172.20.0.10:80/phpinfo.php">PHP Info</a> (if enabled/configured). </li> <li> <strong>SSH Access:</strong> Available via Port 22 (Command Line Access) </li> <li> <strong>Internal Cache:</strong> Redis Service available on Port 6379 </li> <li> <strong>Database Server:</strong><ahref="http://172.20.0.20:3306/">Database Server</a> (Simulated Link) <br>MySQL Service available on 172.20.0.20:3306 </li> <li> <strong>Compromised Web Entry:</strong><ahref="http://172.20.0.3:80/">Compromised Web Server</a> (Simulated Link) <br>Original entry point, should be patched. </li> </ul>
<p>Access to services listed above may require proper authentication or further internal network navigation.</p> </div>