This security exception sounds like an issue of medium trust hosting. We have a separate download package of mojoportal 2.4.0.9 that is configured for medium trust hosting. I would try install that package. Look for the package on the github download page that is named with "mediumtrust"