Is there a way to prevent root user from modifing kernel and boot loader?











up vote
0
down vote

favorite












Suppose that a regular linux machine is compromised by an attacker who obtained a root shell, he can modify the system kernel or modify boot loader to load another kernel.



Is there a way to prevent such modifications?



I want to disable such things for a regular linux os (not a container) installed on a regular pc with only one regular hard disk. I don't want to use read only mediums like cdrom.



A rough theoretical solution is to patch kernel to disallow modifications to MBR plus another area of hard disk (maybe a partition) and store kernel and boot loader files in that area.










share|improve this question


















  • 1




    UEFI secure boot, if that's supported by your "regular PC".
    – Michael Homer
    Dec 2 at 8:03










  • UEFI secure boot only detects the changes on reboot, it does not prevent. I'm looking for another solution.
    – gopy
    Dec 2 at 8:59










  • No you really can not limit root on a running os. If an intruder had physical or root access they can do what they wish. You can, however, use non root users rather than the root account. The only potential protections, imo, from exploits are keeping your system up to date and selinux ( selinux is not fool proof). You can read any linux security book or further hardening guides.
    – Panther
    Dec 2 at 16:12










  • It certainly prevents the “modify the boot loader to load another kernel” case, in that it won’t load another kernel, and module signing prevents injection into the running kernel. I’m not sure what your model is here.
    – Michael Homer
    Dec 2 at 17:03












  • @Panther I understand that root can do anything, but I mean to add changes to kernel that prevent root from doing the above mentioned actions. You advised to read about hardening methods, but I am looking for a new hardening method. It is a new layer of protection.
    – gopy
    Dec 2 at 17:27















up vote
0
down vote

favorite












Suppose that a regular linux machine is compromised by an attacker who obtained a root shell, he can modify the system kernel or modify boot loader to load another kernel.



Is there a way to prevent such modifications?



I want to disable such things for a regular linux os (not a container) installed on a regular pc with only one regular hard disk. I don't want to use read only mediums like cdrom.



A rough theoretical solution is to patch kernel to disallow modifications to MBR plus another area of hard disk (maybe a partition) and store kernel and boot loader files in that area.










share|improve this question


















  • 1




    UEFI secure boot, if that's supported by your "regular PC".
    – Michael Homer
    Dec 2 at 8:03










  • UEFI secure boot only detects the changes on reboot, it does not prevent. I'm looking for another solution.
    – gopy
    Dec 2 at 8:59










  • No you really can not limit root on a running os. If an intruder had physical or root access they can do what they wish. You can, however, use non root users rather than the root account. The only potential protections, imo, from exploits are keeping your system up to date and selinux ( selinux is not fool proof). You can read any linux security book or further hardening guides.
    – Panther
    Dec 2 at 16:12










  • It certainly prevents the “modify the boot loader to load another kernel” case, in that it won’t load another kernel, and module signing prevents injection into the running kernel. I’m not sure what your model is here.
    – Michael Homer
    Dec 2 at 17:03












  • @Panther I understand that root can do anything, but I mean to add changes to kernel that prevent root from doing the above mentioned actions. You advised to read about hardening methods, but I am looking for a new hardening method. It is a new layer of protection.
    – gopy
    Dec 2 at 17:27













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Suppose that a regular linux machine is compromised by an attacker who obtained a root shell, he can modify the system kernel or modify boot loader to load another kernel.



Is there a way to prevent such modifications?



I want to disable such things for a regular linux os (not a container) installed on a regular pc with only one regular hard disk. I don't want to use read only mediums like cdrom.



A rough theoretical solution is to patch kernel to disallow modifications to MBR plus another area of hard disk (maybe a partition) and store kernel and boot loader files in that area.










share|improve this question













Suppose that a regular linux machine is compromised by an attacker who obtained a root shell, he can modify the system kernel or modify boot loader to load another kernel.



Is there a way to prevent such modifications?



I want to disable such things for a regular linux os (not a container) installed on a regular pc with only one regular hard disk. I don't want to use read only mediums like cdrom.



A rough theoretical solution is to patch kernel to disallow modifications to MBR plus another area of hard disk (maybe a partition) and store kernel and boot loader files in that area.







linux kernel security root boot-loader






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Dec 2 at 6:59









gopy

345




345








  • 1




    UEFI secure boot, if that's supported by your "regular PC".
    – Michael Homer
    Dec 2 at 8:03










  • UEFI secure boot only detects the changes on reboot, it does not prevent. I'm looking for another solution.
    – gopy
    Dec 2 at 8:59










  • No you really can not limit root on a running os. If an intruder had physical or root access they can do what they wish. You can, however, use non root users rather than the root account. The only potential protections, imo, from exploits are keeping your system up to date and selinux ( selinux is not fool proof). You can read any linux security book or further hardening guides.
    – Panther
    Dec 2 at 16:12










  • It certainly prevents the “modify the boot loader to load another kernel” case, in that it won’t load another kernel, and module signing prevents injection into the running kernel. I’m not sure what your model is here.
    – Michael Homer
    Dec 2 at 17:03












  • @Panther I understand that root can do anything, but I mean to add changes to kernel that prevent root from doing the above mentioned actions. You advised to read about hardening methods, but I am looking for a new hardening method. It is a new layer of protection.
    – gopy
    Dec 2 at 17:27














  • 1




    UEFI secure boot, if that's supported by your "regular PC".
    – Michael Homer
    Dec 2 at 8:03










  • UEFI secure boot only detects the changes on reboot, it does not prevent. I'm looking for another solution.
    – gopy
    Dec 2 at 8:59










  • No you really can not limit root on a running os. If an intruder had physical or root access they can do what they wish. You can, however, use non root users rather than the root account. The only potential protections, imo, from exploits are keeping your system up to date and selinux ( selinux is not fool proof). You can read any linux security book or further hardening guides.
    – Panther
    Dec 2 at 16:12










  • It certainly prevents the “modify the boot loader to load another kernel” case, in that it won’t load another kernel, and module signing prevents injection into the running kernel. I’m not sure what your model is here.
    – Michael Homer
    Dec 2 at 17:03












  • @Panther I understand that root can do anything, but I mean to add changes to kernel that prevent root from doing the above mentioned actions. You advised to read about hardening methods, but I am looking for a new hardening method. It is a new layer of protection.
    – gopy
    Dec 2 at 17:27








1




1




UEFI secure boot, if that's supported by your "regular PC".
– Michael Homer
Dec 2 at 8:03




UEFI secure boot, if that's supported by your "regular PC".
– Michael Homer
Dec 2 at 8:03












UEFI secure boot only detects the changes on reboot, it does not prevent. I'm looking for another solution.
– gopy
Dec 2 at 8:59




UEFI secure boot only detects the changes on reboot, it does not prevent. I'm looking for another solution.
– gopy
Dec 2 at 8:59












No you really can not limit root on a running os. If an intruder had physical or root access they can do what they wish. You can, however, use non root users rather than the root account. The only potential protections, imo, from exploits are keeping your system up to date and selinux ( selinux is not fool proof). You can read any linux security book or further hardening guides.
– Panther
Dec 2 at 16:12




No you really can not limit root on a running os. If an intruder had physical or root access they can do what they wish. You can, however, use non root users rather than the root account. The only potential protections, imo, from exploits are keeping your system up to date and selinux ( selinux is not fool proof). You can read any linux security book or further hardening guides.
– Panther
Dec 2 at 16:12












It certainly prevents the “modify the boot loader to load another kernel” case, in that it won’t load another kernel, and module signing prevents injection into the running kernel. I’m not sure what your model is here.
– Michael Homer
Dec 2 at 17:03






It certainly prevents the “modify the boot loader to load another kernel” case, in that it won’t load another kernel, and module signing prevents injection into the running kernel. I’m not sure what your model is here.
– Michael Homer
Dec 2 at 17:03














@Panther I understand that root can do anything, but I mean to add changes to kernel that prevent root from doing the above mentioned actions. You advised to read about hardening methods, but I am looking for a new hardening method. It is a new layer of protection.
– gopy
Dec 2 at 17:27




@Panther I understand that root can do anything, but I mean to add changes to kernel that prevent root from doing the above mentioned actions. You advised to read about hardening methods, but I am looking for a new hardening method. It is a new layer of protection.
– gopy
Dec 2 at 17:27










1 Answer
1






active

oldest

votes

















up vote
1
down vote













'UEFI secure boot' would stop a remote attacker from persisting a reboot but they could just re-hack on every reboot.
Local users could just use



mokutil -#-import my_signing_key_pub.der





share|improve this answer





















  • This is a comment to a previous comment not an answer
    – Panther
    Dec 2 at 16:35











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f485450%2fis-there-a-way-to-prevent-root-user-from-modifing-kernel-and-boot-loader%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













'UEFI secure boot' would stop a remote attacker from persisting a reboot but they could just re-hack on every reboot.
Local users could just use



mokutil -#-import my_signing_key_pub.der





share|improve this answer





















  • This is a comment to a previous comment not an answer
    – Panther
    Dec 2 at 16:35















up vote
1
down vote













'UEFI secure boot' would stop a remote attacker from persisting a reboot but they could just re-hack on every reboot.
Local users could just use



mokutil -#-import my_signing_key_pub.der





share|improve this answer





















  • This is a comment to a previous comment not an answer
    – Panther
    Dec 2 at 16:35













up vote
1
down vote










up vote
1
down vote









'UEFI secure boot' would stop a remote attacker from persisting a reboot but they could just re-hack on every reboot.
Local users could just use



mokutil -#-import my_signing_key_pub.der





share|improve this answer












'UEFI secure boot' would stop a remote attacker from persisting a reboot but they could just re-hack on every reboot.
Local users could just use



mokutil -#-import my_signing_key_pub.der






share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 2 at 8:33









user1133275

2,675415




2,675415












  • This is a comment to a previous comment not an answer
    – Panther
    Dec 2 at 16:35


















  • This is a comment to a previous comment not an answer
    – Panther
    Dec 2 at 16:35
















This is a comment to a previous comment not an answer
– Panther
Dec 2 at 16:35




This is a comment to a previous comment not an answer
– Panther
Dec 2 at 16:35


















draft saved

draft discarded




















































Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f485450%2fis-there-a-way-to-prevent-root-user-from-modifing-kernel-and-boot-loader%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Accessing regular linux commands in Huawei's Dopra Linux

Can't connect RFCOMM socket: Host is down

Kernel panic - not syncing: Fatal Exception in Interrupt