Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    pfsense keeping securelevel=3 after reboot.

    Scheduled Pinned Locked Moved Off-Topic & Non-Support Discussion
    7 Posts 4 Posters 1.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      techguy24
      last edited by

      Hello guys,

      I am pretty new to the pfsense firewall however I was told I need to learn it for a cyber security competition coming up. Basically, you have a network you need to defend.

      Last year, I was told that they were able to completely disable the firewall rules by raising the securelevel to lvl 3 and by adding a script to continuously raise the securelevel in case we rebooted. I have been trying to replicate this attack so I know where to look and how to defend against it. I have managed to raise the securelevel to 3 by using the sysctl kern.securelevel=3 command. However, I am not sure how to keep it raised to 3. I have tried changing the sysctl.conf file and the rc.conf file in the /etc/defaults/rc.conf. I switched kern_securelevel_enable to YES and kern_securelevel=3. Note: the rc.conf file in etc/rc.conf says it does not perform a function. So I guess my question is: how do I keep the securelevel raised to 3 after reboot?

      Thanks for taking the time to read that

      1 Reply Last reply Reply Quote 0
      • H
        heper
        last edited by

        you might want to ask the more important question here; how did they gain root access on the pfsense-console ?

        1 Reply Last reply Reply Quote 0
        • jimpJ
          jimp Rebel Alliance Developer Netgate
          last edited by

          pfSense does not use all of FreeBSD's rc system, so rc.conf is not going to do anything at all.

          You might try putting it in /boot/loader.conf.local or adding it under System > Advanced, System Tunables tab.

          If someone had enough access to set that in the first place, the firewall is already compromised though.

          Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

          Need help fast? Netgate Global Support!

          Do not Chat/PM for help!

          1 Reply Last reply Reply Quote 0
          • T
            techguy24
            last edited by

            I discovered that I had to add sysctl to the sysctl.conf file. So I was putting down "kern.securelevel=3" instead of "sysctl kern.securelevel=3". It is a stupid mistake but again I'm new to this. Thanks for the help, I was able to find loader.conf but not loader.conf.local is that the same thing?

            As for how they got root access: honestly, I think they get a head start to use the default credentials before we get our hands on the computers so that might be why they have root access so quickly.

            JeGrJ 1 Reply Last reply Reply Quote 0
            • jimpJ
              jimp Rebel Alliance Developer Netgate
              last edited by

              Nothing you do after the box has been compromised would be able to secure it. Wipe/reload and secure it before it's put back on a network accessible to attackers.

              Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

              Need help fast? Netgate Global Support!

              Do not Chat/PM for help!

              1 Reply Last reply Reply Quote 0
              • jimpJ
                jimp Rebel Alliance Developer Netgate
                last edited by

                And you can create loader.conf.local if it doens't exist (it won't exist by default)

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 0
                • JeGrJ
                  JeGr LAYER 8 Moderator @techguy24
                  last edited by

                  @jmatz88 said in pfsense keeping securelevel=3 after reboot.:

                  I think they get a head start to use the default credentials before we get our hands on the computers so that might be why they have root access so quickly.

                  Then that defeats the purpose of the competition, doesn't it? If you say your aim is to "defend your network", then you should be the one that get's access. No one worth their pay would install a firewall with access to the WAN/insecure network granted and default credentials still in place (even 2.4.4 gives now very big warnings about that). If they get a head start to "attack" a device with default credentials that is no competition to defend but a cleanup job - and the most secure way would be to kill the box (re-install) and bring it back if it is secured - and doesn't have WAN access at all to the web UI. ;)

                  Just 0.02$ because that sounded more like a kobayashi-maru as a "competition" :)

                  Don't forget to upvote 👍 those who kindly offered their time and brainpower to help you!

                  If you're interested, I'm available to discuss details of German-speaking paid support (for companies) if needed.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.