Support

Admin Tools

#35417 Suspicious PHP change

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by on Wednesday, 21 July 2021 20:17 CDT

bluetongue1

Hi there

 

I have a suspicious file report for the below. How can I tell if it is a false positive or if the file has indeed been changed?

 

libraries/joomla/google/embed/analytics.php

 

<?php /** * @package Joomla.Platform * @subpackage Google * * @copyright Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved * @license GNU General Public License version 2 or later; see LICENSE */ defined('JPATH_PLATFORM') or die; /** * Google Analytics embed class for the Joomla Platform. * * @since 3.1.4 * @deprecated 4.0 Use the `joomla/google` package via Composer instead */ class JGoogleEmbedAnalytics extends JGoogleEmbed { /** * Method to get the tracking code * * @return string The Google Analytics tracking code * * @since 3.1.4 */ public function getCode() { return $this->getOption('code'); } /** * Method to set the tracking code * * @param string $code The Google Analytics tracking code * * @return JGoogleEmbedAnalytics The object for method chaining * * @since 3.1.4 */ public function setCode($code) { $this->setOption('code', $code); return $this; } /** * Checks if the javascript is set to be asynchronous * * @return boolean True if asynchronous * * @since 3.1.4 */ public function isAsync() { return $this->getOption('async') === null ? true : $this->getOption('async'); } /** * Load javascript asynchronously * * @return JGoogleEmbedAnalytics The object for method chaining * * @since 3.1.4 */ public function useAsync() { $this->setOption('async', true); return $this; } /** * Load javascript synchronously * * @return JGoogleEmbedAnalytics The object for method chaining * * @since 3.1.4 */ public function useSync() { $this->setOption('async', false); return $this; } /** * Add an analytics call * * @param string $method The name of the function * @param array $params The parameters for the call * * @return array The added call * * @since 3.1.4 */ public function addCall($method, $params = array()) { $call = array('name' => $method, 'params' => $params); $calls = $this->listCalls(); $calls[] = $call; $this->setOption('calls', $calls); return $call; } /** * List the analytics calls to be executed * * @return array A list of calls * * @since 3.1.4 */ public function listCalls() { return $this->getOption('calls') ? $this->getOption('calls') : array(); } /** * Delete a call from the stack * * @param int $index Index of call to delete (defaults to last added call) * * @return array The deleted call * * @since 3.1.4 */ public function deleteCall($index = null) { $calls = $this->listCalls(); if ($index === null) { $index = count($calls) - 1; } $call = $calls[$index]; unset($calls[$index]); $calls = array_values($calls); $this->setOption('calls', $calls); return $call; } /** * Create a javascript function from the call parameters * * @param string $method The name of the function * @param array $params The parameters for the call * * @return string The created call * * @since 3.1.4 */ public function createCall($method, $params = array()) { $params = array_values($params); if ($this->isAsync()) { $output = "_gaq.push(['{$method}',"; $output .= substr(json_encode($params), 1, -1); $output .= ']);'; } else { $output = "pageTracker.{$method}("; $output .= substr(json_encode($params), 1, -1); $output .= ');'; } return $output; } /** * Add a custom variable to the analytics * * @param int $slot The slot to store the variable in (1-5) * @param string $name The variable name * @param string $value The variable value * @param int $scope The scope of the variable (1: visitor level, 2: session level, 3: page level) * * @return array The added call * * @since 3.1.4 */ public function addCustomVar($slot, $name, $value, $scope = 3) { return $this->addCall('_setCustomVar', array($slot, $name, $value, $scope)); } /** * Get the code to create a custom analytics variable * * @param int $slot The slot to store the variable in (1-5) * @param string $name The variable name * @param string $value The variable value * @param int $scope The scope of the variable (1: visitor level, 2: session level, 3: page level) * * @return string The created call * * @since 3.1.4 */ public function createCustomVar($slot, $name, $value, $scope = 3) { return $this->createCall('_setCustomVar', array($slot, $name, $value, $scope)); } /** * Track an analytics event * * @param string $category The general event category * @param string $action The event action * @param string $label The event description * @param string $value The value of the event * @param boolean $noninteract Don't allow this event to impact bounce statistics * * @return array The added call * * @since 3.1.4 */ public function addEvent($category, $action, $label = null, $value = null, $noninteract = false) { return $this->addCall('_trackEvent', array($category, $action, $label, $value, $noninteract)); } /** * Get the code to track an analytics event * * @param string $category The general event category * @param string $action The event action * @param string $label The event description * @param string $value The value of the event * @param boolean $noninteract Don't allow this event to impact bounce statistics * * @return string The created call * * @since 3.1.4 */ public function createEvent($category, $action, $label = null, $value = null, $noninteract = false) { return $this->createCall('_trackEvent', array($category, $action, $label, $value, $noninteract)); } /** * Get code to load Google Analytics javascript * * @return string Javascript code * * @since 3.1.4 */ public function getHeader() { if (!$this->isAsync()) { // Synchronous code is included only in the body return ''; } if (!$this->getOption('code')) { throw new UnexpectedValueException('A Google Analytics tracking code is required.'); } $code = $this->getOption('code'); $output = ''; return $output; } /** * Google Analytics only needs to be included in the header * * @return null * * @since 3.1.4 */ public function getBody() { if (!$this->getOption('code')) { throw new UnexpectedValueException('A Google Analytics tracking code is required.'); } $prefix = $this->isSecure() ? 'https://ssl' : 'http://www'; $code = $this->getOption('code'); if ($this->isAsync()) { $output = ''; } else { $output = ''; $output .= ''; } return $output; } }

nicholas
Akeeba Staff
Manager

You can compare it with the legitimate version of the file in https://github.com/joomla/joomla-cms/tree/staging/libraries/joomla/google/embed or by downloading the Joomla installation ZIP, extract it and compare the libraries/joomla/google/embed/analytics.php file with the one on your site.

I cannot do that for you since the file's code you copied inline to your ticket gets all messed up due to the filtering we apply on ticket text.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

System Task
system
This ticket has been automatically closed. All tickets which have been inactive for a long time are automatically closed. If you believe that this ticket was closed in error, please contact us.

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!