The Magento used is the "develop" branch.
PHP: PHP 7.0.10-1+deb.sury.org~xenial+1
After a debugging session, it appears that the security key is incorrectly generated during either the creation of backend URLs or the security key validation.
If you place a breakpoint at the last line of \Magento\Backend\Model\Url::getSecretKey(), you'll notice the following discrepancy:
These are stack traces and secret sources for hashing in my case (Magento ver. 2.2.0-rc30).
Secret key generation for navigation links:

Secret key validation on route action:

My module's descriptors for routes & menu:
./etc/adminhtml/routes.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="fl32_login_as_route" frontName="loginas">
<module name="Flancer32_LoginAs"/>
</route>
</router>
</config>
./etc/adminhtml/menu.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add id="Flancer32_LoginAs::customer_logged"
module="Flancer32_LoginAs"
action="loginas/logged"/>
</menu>
</config>
@AlexandreKhayrullin, thank you for your report.
We've created internal ticket(s) MAGETWO-81949 to track progress on the issue.
Hi @AlexandreKhayrullin
This ticket has been marked as "Triage Wanted" due to low user involvement over time. Over the next 2 weeks we are looking for additional community feedback to decide if it should be archived or not. More information on this is available on the GitHub wiki.
Thank you for collaboration.
I have a commit that I'm testing, please don't close this.
Hi @AlexandreKhayrullin. Thank you for your report.
The issue has been fixed in magento/magento2#17650 by @lfolco in 2.3-develop branch
Related commit(s):
The fix will be available with the upcoming 2.3.0 release.
Hi @AlexandreKhayrullin. Thank you for your report.
The issue has been fixed in magento/magento2#18018 by @lfolco in 2.2-develop branch
Related commit(s):
The fix will be available with the upcoming 2.2.8 release.
Fix is wrong in 2.2.8.
code in 2.2.8
protected function _callbackSecretKey($match)
{
$routeId = $this->routeConfig->getRouteByFrontName($match[1]);
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey(
$routeId,
$match[2],
$match[3]
);
}
code in 2.3
protected function _callbackSecretKey($match)
{
$routeId = $this->routeConfig->getRouteByFrontName($match[1]);
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey(
$routeId?:$match[1],
$match[2],
$match[3]
);
}
Had this issue after upgrading to 2.2.8. Caused problems if the admin/startup/menu_item_id is set to redirect to a specific page after login, I was unable to access any of the adminhtml routes and was redirected back to the page defined in admin/startup/menu_item_id.
Definitely still broken in 2.2.8 - can this be re-opened @sidolov ?
Hi @chrisputnam9 , yes, we should reopen it if the issue still reproducing
Still is being reproduced on 2.3.1.
I`ll reopen and fix it when I have some time.
Hi @novikor. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[ ] 2. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
Most helpful comment
Fix is wrong in 2.2.8.
code in 2.2.8
protected function _callbackSecretKey($match)
{
$routeId = $this->routeConfig->getRouteByFrontName($match[1]);
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey(
$routeId,
$match[2],
$match[3]
);
}
code in 2.3
protected function _callbackSecretKey($match)
{
$routeId = $this->routeConfig->getRouteByFrontName($match[1]);
return \Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME . '/' . $this->_url->getSecretKey(
$routeId?:$match[1],
$match[2],
$match[3]
);
}