OpenCart 3.0.3.8 Invalid Token / Javascript Problem

43 Views Asked by At

I am trying to troubleshoot an Opencart Installation, which was working fine until Dec 2023. Currently, when I Select the Menu on the Left side of the Admin Panel or the Tabs on the Page I will get an Invalid Token Error and I need to login Again. htaccess is configured correctly and there are no PHP errors. However the Javascript debugger will give me the following Errors :

Uncaught SyntaxError: expected expression, got '}'
jquery-2.1.1.min.js:5:2623
Uncaught SyntaxError: expected expression, got '}'
bootstrap.min.js:7:7279
Uncaught SyntaxError: expected expression, got '}'
moment.min.js:7:21941
Uncaught SyntaxError: expected expression, got '}'
moment-with-locales.min.js:505:12296
Uncaught SyntaxError: expected expression, got '}'
bootstrap-datetimepicker.min.js:1385:2623
Uncaught SyntaxError: expected expression, got '}'
common.js:288:2623
Uncaught SyntaxError: expected expression, got '}'
jquery.vmap.js:75:2798
Uncaught SyntaxError: expected expression, got '}'
jquery.vmap.world.js:1:63187
Uncaught ReferenceError: $ is not defined
    <anonymous> https://bookstore.esnk.org/admin/index.php?route=common/dashboard&user_token=xxxxxxxxxxxxxxxx:320
index.php:320:1
Uncaught SyntaxError: expected expression, got '}'
jquery.flot.js:406:2946
Uncaught SyntaxError: expected expression, got '}'
jquery.flot.resize.min.js:19:3826
Uncaught ReferenceError: $ is not defined
    <anonymous> https://bookstore.esnk.org/admin/index.php?route=common/dashboard&user_token=xxxxxxxxxxxxxx:374
index.php:374:1
Uncaught ReferenceError: $ is not defined
    <anonymous> https://bookstore.esnk.org/admin/index.php?route=common/dashboard&user_token=xxxxxxxxx:521

The Index PHP will Error on the first $ sign:

$('#range a').on('click', function(e) {
    e.preventDefault();
    
    $(this).parent().parent().find('li').removeClass('active');
    
    $(this).parent().addClass('active');
    
    $.ajax({
        type: 'get',
        url: 'index.php?route=extension/dashboard/chart/chart&user_token=xxxxxxxxxxx5&range=' + $(this).attr('href'),
        dataType: 'json',
        success: function(json) {
            if (typeof json['order'] == 'undefined') { return false; }
            
            var option = {  
                shadowSize: 0,
                colors: ['#9FD5F1', '#1065D2'],
                bars: { 
                    show: true,
                    fill: true,
                    lineWidth: 1
                },
                grid: {
                    backgroundColor: '#FFFFFF',
                    hoverable: true
                },
                points: {
                    show: false
                },
                xaxis: {
                    show: true,
                    ticks: json['xaxis']
                }
            }

Any Ideas how to solve this matter ? Please note I replaced the Token with XXXXXXX for this post.

1

There are 1 best solutions below

0
Wolfgang On

I found out that the site was infected by a trojan, which modified the .js Files, Replacing all .js files solved the problem.