Logging In to the Bitrix Admin Panel Without a Password

1 min read
Sometimes you have FTP access but do not have the administrator account password. In this situation, you can use a simple script that logs you in and then deletes itself, helping to avoid potential security issues.


<? require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/header.php"); 
global $USER; 
$USER->Authorize(1); 
@unlink(__FILE__); 
LocalRedirect("/bitrix/admin/"); 
require($_SERVER["DOCUMENT_ROOT"] . "/bitrix/footer.php");?> 

If this does not log you in, add the following constants at the beginning of the file:


const NOT_CHECK_PERMISSIONS = true;
const NO_KEEP_STATISTIC     = 'Y';
const NO_AGENT_STATISTIC    = 'Y';
const NO_AGENT_CHECK        = true;
const PUBLIC_AJAX_MODE      = true;
const DisableEventsCheck    = true;

Only one of these is actually needed, but the others may prove useful later.

If the first approach does not help, add $GLOBALS["USER"]->Authorize(1); after each new CUser; in /bitrix/modules/main/include.php:


$GLOBALS["USER"]->Authorize(1);

Back to blog