Ubuntu boot loaders (here grubx64.efi), which are signed for secure boot, internally always refer to grub.cfg in the boot directory "EFI/ubuntu/" in the EFI system partition. If changed e.g. via hex editor, the UEFI boot signature check of it will and must fail.
A fix could be to remove the fixation on "EFI/ubuntu/" in grubx64.efi and instead to detect the belonging "EFI/xxx/grub.cfg" by examination of it's own location "EFI/xxx/".
Ubuntu boot loaders (here grubx64.efi), which are signed for secure boot, internally always refer to grub.cfg in the boot directory "EFI/ubuntu/" in the EFI system partition. If changed e.g. via hex editor, the UEFI boot signature check of it will and must fail.
A fix could be to remove the fixation on "EFI/ubuntu/" in grubx64.efi and instead to detect the belonging "EFI/xxx/grub.cfg" by examination of it's own location "EFI/xxx/".