Internal Server Error

Hi there. I would like to feedback on the internal server error, which MobSF present.
So basically, so basically when I run the code on the browser itself. It only shows internal server. And when I change debug to true, it still shows internal server error without any stack trace.I am currently running on python 3.10 and using mobsf version 3.7.6 and running on ubuntu. I do make some code changes from now and then. It is only “Internal Server Error” without any other error.

Welcome @flamecopper !

Depending upon how you have your logging configured, you may find the details of the errors in a log file. (This could be an application log, or even syslog.) See Logging | Django documentation | Django for details.

If you have your email connection configured for the server, Django will email the specifics of a 500 error to you. See How to manage error reporting | Django documentation | Django for details.

@KenWhitesell

Hi there can you refer this to me and what are the possible things that it could actually hide the error? I am very new to this.

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'formatters': {
        'standard': {
            'format': '[%(levelname)s] %(asctime)-15s - %(message)s',
            'datefmt': '%d/%b/%Y %H:%M:%S',
        },
        'color': {
            '()': 'colorlog.ColoredFormatter',
            'format':
                '%(log_color)s[%(levelname)s] %(asctime)-15s - %(message)s',
            'datefmt': '%d/%b/%Y %H:%M:%S',
            'log_colors': {
                'DEBUG': 'cyan',
                'INFO': 'green',
                'WARNING': 'yellow',
                'ERROR': 'red',
                'CRITICAL': 'red,bg_white',
            },
        },
    },
    'handlers': {
        'logfile': {
            'level': 'DEBUG',
            'class': 'logging.FileHandler',
            'filename': os.path.join(MobSF_HOME, 'debug.log'),
            'formatter': 'standard',
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'color',
        },
    },
    'loggers': {
        'django': {
            'handlers': ['console', 'logfile'],
            'level': 'DEBUG',
            'propagate': True,
        },
        'django.db.backends': {
            'handlers': ['console', 'logfile'],
            # DEBUG will log all queries, so change it to WARNING.
            'level': 'INFO',
            'propagate': False,   # Don't propagate to other handlers
        },
        'mobsf.MobSF': {
            'handlers': ['console', 'logfile'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'mobsf.StaticAnalyzer': {
            'handlers': ['console', 'logfile'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'mobsf.MalwareAnalyzer': {
            'handlers': ['console', 'logfile'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'mobsf.DynamicAnalyzer': {
            'handlers': ['console', 'logfile'],
            'level': 'DEBUG',
            'propagate': False,
        },
        'django_auth_ldap': {
            'level': 'DEBUG',
            'handlers': ['console']}
        ,
    },
}

I don’t know what you mean by “hide the error” here.

You should be able to find the log file in the MobSF_HOME directory, assuming your process has the permissions necessary to write them there. (If not, you should see an error in your applications log or syslog.

I mean displaying nothing apart from “Internal Server Error”. Plus, I don’t see the error on the application log. Could it be because of this? ‘propagate’: False?

That’s how it’s supposed to work. You don’t want to expose internal information (by default) to the outside world when an error occurs. By setting DEBUG = False, this is one of the internal behavioral changes made by Django. (Again, see the page referenced above on “How to manage error reporting”.)

No, that’s not what the propagate setting does.

Check syslog as well.

(Is there a file named debug.log in MobSF_HOME? If so, is there anything in it?)

The error message is not useful.
So in one of the controller file I have changed to : file_type = request.POST[‘scan_type’ → deliberately create an error. No useful error message is shown. The only error show is from the settings.py. By the way, I am using gunicorn with wsgi → could be due to such settings?

So it does show everything except syntax and package import error. And I really need that

When describing situations like this, please be more specific and detailed. Don’t just describe the messages you are getting, post the messages themselves, in full, along with identifying what file you are finding them in.