Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added A Method To Fix CR0 and CR4 Bits During VMX Operation #25

Closed
vxcute opened this issue Feb 26, 2021 · 4 comments
Closed

Added A Method To Fix CR0 and CR4 Bits During VMX Operation #25

vxcute opened this issue Feb 26, 2021 · 4 comments
Assignees

Comments

@vxcute
Copy link
Contributor

vxcute commented Feb 26, 2021

Hello All, I Added a Method To The Code To Insure That CR0 and CR4 Registers Not Be Changed During The VMX Operation The IDEA Is Derived From The Intel Manual Here:

intel

And The Code Is From https://revers.engineering/day-2-entering-vmx-operation/ However I made Some Changes To It So I Can Follow The Project Coding Style:

  VOID
FixCr4AndCr0Bits()
{
    CR_FIXED Cr_Fixed           = {0};
    CONTROL_REGISTER_4 Cr4      = {0};
    CONTROL_REGISTER_0 Cr0      = {0};

    Cr_Fixed.All = __readmsr(MSR_IA32_VMX_CR0_FIXED0);
    Cr0.Flags    = __readcr0();
    Cr0.Flags |= Cr_Fixed.Split.Low;
    Cr_Fixed.All = __readmsr(MSR_IA32_VMX_CR0_FIXED1);
    Cr0.Flags &= Cr_Fixed.Split.Low;
    __writecr0(Cr0.Flags);
    Cr_Fixed.All = __readmsr(MSR_IA32_VMX_CR4_FIXED0);
    Cr4.Flags = __readcr4();
    Cr4.Flags |= Cr_Fixed.Split.Low;
    Cr_Fixed.All = __readmsr(MSR_IA32_VMX_CR4_FIXED1);
    Cr4.Flags &= Cr_Fixed.Split.Low;
    __writecr4(Cr4.Flags);
}     

The Function Can Be Added After Enabling VMX Operation Here =>

LogInfo("VMX-Operation Enabled Successfully");

Structures Can Be Found Here https://gist.github.com/0xastr0/64446c135cddda13cb26d1dd7d0f4502

Thanks I Hope I Can Contribute More I Really Fall In love with the Project Keep The Good Work ❤

@vxcute vxcute changed the title Added Method To Fix CR0 and CR4 Bits In VMX Operation Added A Method To Fix CR0 and CR4 Bits In VMX Operation Feb 26, 2021
@vxcute vxcute changed the title Added A Method To Fix CR0 and CR4 Bits In VMX Operation Added A Method To Fix CR0 and CR4 Bits During VMX Operation Feb 26, 2021
@SinaKarvandi SinaKarvandi self-assigned this May 25, 2021
@SinaKarvandi
Copy link
Member

SinaKarvandi commented May 25, 2021

Thank you for your report. I'll fix it soon. ❤
Also, what happened to your Twitter account? I think it's removed. Is everything okay? Are you safe from the pandemic?
DM me as soon as you re-activate your account. I miss you on Twitter.

@vxcute
Copy link
Contributor Author

vxcute commented May 25, 2021

Hello, I am doing good I removed my Twitter account just to get out of social media a little hahaha anyways good luck I am so excited to see this project released. I Miss U Too U Can Try contacting me on telegram ahmedl0l or astr0#8214 discord if u want :)

@vxcute
Copy link
Contributor Author

vxcute commented May 25, 2021

I Translated This to a pull request so it can be easier to maintain u actually got my attention again 😅

@SinaKarvandi
Copy link
Member

SinaKarvandi commented May 25, 2021

Thanks for your report.
Merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants