This file is indexed.

/usr/share/zoneminder/views/image.php is in zoneminder 1.26.5-1ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
<?php
//
// ZoneMinder web image view file, $Date: 2008-09-29 14:15:13 +0100 (Mon, 29 Sep 2008) $, $Revision: 2640 $
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//

if ( !canView( 'Events' ) )
{
    $view = "error";
    return;
}

header( 'Content-type: image/jpeg' );

$errorText = false;
if ( empty($_REQUEST['path']) )
{
    $errorText = "No image path";
}
else
{
    $path = $_REQUEST['path'];
    if ( !empty($user['MonitorIds']) )
    {
        $imageOk = false;
        $pathMonId = substr( $path, 0, strspn( $path, "1234567890" ) );
        foreach ( preg_split( '/["\'\s]*,["\'\s]*/', $user['MonitorIds'] ) as $monId )
        {
            if ( $pathMonId == $monId )
            {
                $imageOk = true;
                break;
            }
        }
        if ( !$imageOk )
            $errorText = "No image permissions";
    }
}

if ( true )
{
    // Simple version
    if ( $errorText )
        Error( $errorText );
    else
        readfile( ZM_DIR_EVENTS.'/'.$path );
}
else
{
    // Not so simple version
    if ( !function_exists( "imagecreatefromjpeg" ) )
        Warning( "The imagecreatefromjpeg function is not present, php-gd not installed?" );

    if ( !$errorText )
    {
        if ( !($image = imagecreatefromjpeg( ZM_DIR_EVENTS.'/'.$path )) )
        {
            $errorText = "Can't load image";
            $error = error_get_last();
            Error( $error['message'] );
        }
    }

    if ( $errorText )
    {
        if ( !($image = imagecreatetruecolor( 160, 120 )) )
        {
            $error = error_get_last();
            Error( $error['message'] );
        }
        if ( !($textColor = imagecolorallocate( $image, 255, 0, 0 )) )
        {
            $error = error_get_last();
            Error( $error['message'] );
        }
        if ( !imagestring( $image, 1, 20, 60, $errorText, $textColor ) )
        {
            $error = error_get_last();
            Error( $error['message'] );
        }
        Fatal( $errorText." - ".$path );
    }

    imagejpeg( $image );

    imagedestroy( $image );
}
?>