Jump to content











Photo
- - - - -

Unrelated babblings on menu.lst


  • Please log in to reply
13 replies to this topic

#1 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 11 March 2018 - 12:47 AM

This is the preset_menu.lst file. Grub4dos also has an option to embed other files instead.
./configure --enable-preset-menu=../preset_menu.lst
I noticed that Grub4dos will load the configuration file (default is /menu.lst) on the first partition (hd0,0). If this file does not exist, it will load the embedded configuration.

Edited by nguyentu, 11 March 2018 - 12:53 AM.


#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14401 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 March 2018 - 03:15 AM

This is the preset_menu.lst file. Grub4dos also has an option to embed other files instead.

./configure --enable-preset-menu=../preset_menu.lst
I noticed that Grub4dos will load the configuration file (default is /menu.lst) on the first partition (hd0,0). If this file does not exist, it will load the embedded configuration.

No, unless this ahas also changed lately..
Grub4dos loads (loaded) FIRST THING the embedded menu.lst (which source is "preset_menu.lst").
Then the commands in the embedded menu.lst are executed.

configfile /boot/grub/menu.lst
configfile /grub/menu.lst
if "%@root%"=="(ud)" && calc *0x82A0=*0x82b9&0xff
if "%@root:~1,1%"=="f" && find --set-root --devices=f /menu.lst && configfile /menu.lst
find --set-root --ignore-floppies --ignore-cd /menu.lst && configfile /menu.lst
find --set-root --ignore-floppies --ignore-cd /boot/grub/menu.lst && configfile /boot/grub/menu.lst
find --set-root --ignore-floppies --ignore-cd /grub/menu.lst && configfile /grub/menu.lst

 
menu.lst is looked for on the same volume grldr (or grub.exe) has been run from, then in other volumes.
 
Up to here, this is "normal" and how grub4dos has always worked.
Even if the logic has changed and a menu.lst in root is loaded before the embedded one (which I doubt) if there is no menu.lst in root, those commands in the embedded menu.lst will be executed.
 
 
The "news" are that if no "local" menu.lst is found, it will seemingly attempt a http: connection to Chenall's site:

configfile http://b.chenall.net/menu.lst

 
loading a menu.lst there that has options to map and chainload payloads that also reside on that same http: site.
 
I have my personal doubts that it will actually work in most cases, still in some cases/setups it may "phone home".
 
What could possibly go wrong? :dubbio:
 
:duff:
Wonko

#3 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 11 March 2018 - 03:36 AM

@Wonko:

 

I see an embedded configuration file that contains:

timeout 1

Ok, if you think that Grub4dos will load the embedded configuration file first, you will see the following menus for 1 second.

find /menu.lst, /boot/grub/menu.lst, /grub/menu.lst
commandline
reboot
halt
You can try, the embedded configuration is only executed when you delete the /menu.lst file on the first partition.


#4 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14401 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 March 2018 - 04:00 AM

Look, download this file:

http://dl.grub4dos.c...a-2018-03-03.7z

 

Extract from the archive grldr and grub.exe.

 

Open grldr in a hex editor, go to offset 0x04E50C.

Copy from there to the end of the file.

Paste in a text editor.

 

This is the result:





pxe detect
configfile
default 0
timeout 1

title find /menu.lst, /boot/grub/menu.lst, /grub/menu.lst
	errorcheck off
	configfile /boot/grub/menu.lst
	configfile /grub/menu.lst
	if "%@root%"=="(ud)" && calc *0x82A0=*0x82b9&0xff
	if "%@root:~1,1%"=="f" && find --set-root --devices=f /menu.lst && configfile /menu.lst
	find --set-root --ignore-floppies --ignore-cd /menu.lst && configfile /menu.lst
	find --set-root --ignore-floppies --ignore-cd /boot/grub/menu.lst && configfile /boot/grub/menu.lst
	find --set-root --ignore-floppies --ignore-cd /grub/menu.lst && configfile /grub/menu.lst
	configfile http://b.chenall.net/menu.lst
	errorcheck on
	commandline

title commandline
	commandline

title reboot
	reboot

title halt
	halt

You can do the same with grub.exe, the offset in that case is 0x051F0C

 

As said until recently the embedded menu was loaded FIRST THING, but EVEN IF now a menu.lst on (hd0,0) is attempted to be loaded (which I still doubt), it DOES NOT CHANGE the issue[1], IF that menu.lst is missing, the embedded one will be executed.

 

:duff:

Wonko

 

[1] The issue is about the "phoning home", not about the particular conditions in which it can be triggered.

You can download the http://b.chenall.net/menu.lstjust fine, here it is:

Spoiler


#5 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 11 March 2018 - 04:08 AM

Sure.
 
If you have two different /menu.lst files, then put each file on each partition. Then boot grub.exe or grldr from the second partition, what /menu.lst file will be executed?


#6 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14401 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 March 2018 - 04:14 AM

 

Sure.
 
If you have two different /menu.lst files, then put each file on each partition. Then boot grub.exe or grldr from the second partition, what /menu.lst file will be executed?

 

The first one that will be found.

 

Drives in the line:

find --set-root --ignore-floppies --ignore-cd /menu.lst && configfile /menu.lst

 

are looked for as:

(hd0,0)

(hd0,1)

(hd0,2)

...

 

But AGAIN, that is not at all the issue at hand.

 

:duff:

Wonko



#7 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 11 March 2018 - 04:21 AM

I modified some files in the source code to change the name (and path) of the default configfile (/menu.lst) and the embedded configuration.

Of course we can modify the HEX code (0x2017 for path and filename).


#8 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14401 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 March 2018 - 04:44 AM

 

I modified some files in the source code to change the name (and path) of the default configfile (/menu.lst) and the embedded configuration.

Of course we can modify the HEX code (0x2017 for path and filename).

 

Ok that's enough.

 

Original thread pinned and locked:

http://reboot.pro/to...bedded-menulst/

 

:duff:

Wonko



#9 steve6375

steve6375

    Platinum Member

  • Developer
  • 6768 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 11 March 2018 - 10:48 AM

AFAIK, The standard embedded menu is always executed first. It has

configfile

as the second line. This command will attempt to load \menu.lst from the current boot partition only.

 

If the file does not exist then the first menu entry in the embedded menu will be executed.

 

The http entry does seem rather strange (and I'm not sure under what circumstances it would ever work?).

 

I have raised an Issue...

https://github.com/c...4dos/issues/170



#10 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 11 March 2018 - 10:58 AM

 Well I'm sorry, I do not see the second line configfile command.


Edited by nguyentu, 11 March 2018 - 11:02 AM.


#11 steve6375

steve6375

    Platinum Member

  • Developer
  • 6768 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 11 March 2018 - 11:01 AM

configfile is the second line in the menu (from the top) - it is not in a menu entry.

It executes automatically

The first 4 lines are executed immediately, the 2nd line is the one that loads \menu.lst in normal situations.

pxe detect
configfile
default 0
timeout 1


#12 steve6375

steve6375

    Platinum Member

  • Developer
  • 6768 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films,guitars
  •  
    United Kingdom

Posted 11 March 2018 - 11:07 AM

P.S. The configfile command will load /menu.lst (default path) when first executed.

However, if  say 

configfile /steve/menu.lst

is run, then the simple command of

configfile

will load /steve/menu.lst again (i.e. the path is remembered).



#13 nguyentu

nguyentu

    Frequent Member

  • Advanced user
  • 102 posts
  •  
    Vietnam

Posted 11 March 2018 - 11:08 AM

Thank you for explaining this point to me.
I tested it and it is true that only the embedded configuration will be executed.


#14 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 14401 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 11 March 2018 - 12:11 PM

The http entry does seem rather strange (and I'm not sure under what circumstances it would ever work?).

Yep, that is what I also wonder. :dubbio:

As said the linked to menu.lst via http: is accessible alright AND all the payloads mentioned in the menu.lst (as relative paths) are available (the only one with full http: path being the boot.ipxe)

I have raised an Issue...
https://github.com/c...4dos/issues/170


Good :), let's see what the good programmer(s) reply. :unsure:

:duff:
Wonko




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users