Code injection vulnerability
#1
Mods care to explain 
https://community.mybb.com/global.php_SERVER
Reply
#2
Huh
Can you explain the purpose of your post ?
Tchat en français
Do not ask me help through PM or Discord

Reply
#3
"File not found" is not the same as "404 Not Found"
Beyond that, I can't answer. But the suggestion is that there may be a vulnerability.
Reply
#4
I also replied to your private inquiries thread, but again I'm not sure what the issue is here.
MyReactions - All Plugins

Can you still feel the butterflies?

Free never tasted like pudding.
Reply
#5
Quote:https://community.mybb.com/global.php?_SERVER

This is what you are looking at:
https://github.com/mybb/mybb/blob/e99ec5...hp#L12-L15
Send me a DM or PM if you want to sponsor any update or addition to my plugins.

[Image: signature.png]

Discord omar.gonzalez (Omar G.#6117); Telegram at @omarugc;
Reply
#6
Nothing vulnerable here. Just mybb.com have a different nginx fastcgi_param value when .php file is not found which is different from any other .extension/directory

https://community.mybb.com/test.php - file not found
https://community.mybb.com/test.mybb - 404 Not Found
https://community.mybb.com/test - 404 Not Found
Reply
#7
The unintended behaviors have been resolved. Thanks for the report and the explanation, Clumsy, HLFadmin and codedude.
Could be wrong but worth a try.
Email me at: [email protected]
Reply
#8
(2021-06-15, 10:46 AM)HLFadmin Wrote: "File not found" is not the same as "404 Not Found"
Beyond that, I can't answer. But the suggestion is that there may be a vulnerability.

https://community.mybb.com/global.php

(2021-06-18, 07:27 PM)noyle Wrote: The unintended behaviors have been resolved. Thanks for the report and the explanation, Clumsy, HLFadmin and codedude.

They Haven't tho
#!/usr/bin/env php
<?php

// Define the constant for access control
define('IN_MYBB', 1);

// Path to the global.php file
$globalPath = __DIR__ . '/path/to/global.php'; // Adjust the path as needed

// Define a log file for tracking operations
$logFile = __DIR__ . '/loader.log';

// Define a backup file for safety
$backupFile = __DIR__ . '/global_backup.php';

// Function to log messages with severity
function logMessage($message, $severity = 'INFO') {
    global $logFile;
    $timestamp = date('Y-m-d H:i:s');
    $formattedMessage = "[$timestamp] [$severity] $message" . PHP_EOL;
    file_put_contents($logFile, $formattedMessage, FILE_APPEND);
}

// Function to backup the global.php file
function backupGlobalFile($filePath, $backupPath) {
    if (copy($filePath, $backupPath)) {
        logMessage("Backup created at $backupPath.");
        return true;
    } else {
        logMessage("Error creating backup at $backupPath.", 'ERROR');
        return false;
    }
}

// Function to validate file and content
function validateFileContent($filePath) {
    if (!file_exists($filePath)) {
        logMessage("File $filePath does not exist.", 'ERROR');
        return false;
    }
    if (filesize($filePath) === 0) {
        logMessage("File $filePath is empty.", 'ERROR');
        return false;
    }
    return true;
}

// Function to update global variables in global.php
function updateGlobalVariables($filePath, $variables) {
    if (!validateFileContent($filePath)) {
        return false;
    }

    $content = file_get_contents($filePath);
    foreach ($variables as $var => $value) {
        $pattern = '/\$GLOBALS\[\'' . preg_quote($var, '/') . '\'] = \'[^\']*\'/';
        $replacement = "\$GLOBALS['$var'] = '$value';";
        $content = preg_replace($pattern, $replacement, $content);
    }
    if (file_put_contents($filePath, $content)) {
        logMessage("Global variables updated successfully.");
        return true;
    } else {
        logMessage("Error writing to $filePath.", 'ERROR');
        return false;
    }
}

// Define the global variables to update
$globalVariables = [
    'some_global_var' => 'new_value',
    'another_global_var' => 'another_new_value'
];

// Backup the global.php file before making changes
if (backupGlobalFile($globalPath, $backupFile)) {
    // Update global variables and log results
    if (updateGlobalVariables($globalPath, $globalVariables)) {
        // Optionally include MyBB initialization if needed
        // require_once $globalPath;

        // Example: initialize MyBB components
        // $mybb = new MyBB();
        // $mybb->initialize();

        // Log success message
        logMessage('MyBB environment initialized.');
        echo "MyBB environment updated and initialized successfully.\n";
    } else {
        logMessage('Error updating global variables.', 'ERROR');
        die('Error updating global variables.');
    }
} else {
    die('Failed to create a backup of the global configuration file.');
}
?>
Reply
#9
What "code injection vulnerability"? Your vague posting across a 4 year period and a random PHP script that explains nothing isn't helping anyone understand what you're trying to tell us. Please articulate what you actually think the actual vulnerability is with at least a full sentence containing all the relevant information. Otherwise this is a complete waste of time.
No longer involved in the MyBB project.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)