-
Notifications
You must be signed in to change notification settings - Fork 1
Console self-elevation #48
Comments
Hm, maybe. It'd be a simpler version than gsudo, just supporting /n: |
Done. Ended up taking a "hybrid" approach to the environment: variables that exist in the current |
Good job, will test it... |
Really nice @adoxa. |
Yes, that's what's supposed to happen, isn't it? You run |
Original intend of this extension is not to bypass UAC prompt (decrease security level), but to keep elevated process (more specific: its output) in original console window. |
I like the 15 minutes feature, but I think will better have that time customizable, I think with a values of 0 for ask every time authorization, -1 for have authorized until the unload, and a positive integer with the minutes. |
Now that I think about it, it's a major security hole - another process could just wait for it to open then run its own elevated command. I could limit it like gsudo, so only the particular |
Do the |
Have you tried
|
No, I do not, as en Elevate extension is not yet listed in web documentation, do not expect any other docs. Thanks for point me to this.
|
@lazna, we are trying to embed all the necessary documentation in the help of the dll itself. When the first version be released the documentation of the site will be the same of the dll with more examples. |
The security hole was removed (reduced) by @adoxa in #b11bcc2 |
I am voting for an option. Sorry for mess with topic closing, I am still not a friend with github :-/ |
I think it's pretty hard to exploit, so I don't see an option as necessary. Although I wouldn't do it as an option, anyway, I'd just remove it and always prompt (run the batch itself elevated to avoid multiple prompts). The exploit would require knowing the value of the pointer to the current batch file at the first use of |
Is possible to create a little call helper, that elevate the same batch with same parameters and all? For use as this:
|
Might even be able to do all it in the call: @Echo Off
call @SelfElevate [msg]
rem only executed if admin
rem if not admin the call displays msg (or a default) and goes to EOF itself |
@adoxa I like that. But I'm asking about the msg, maybe we can have two messages, one for explaining that the cmd needs permission and if the user press "Yes", in that case, the elevation is requested, If it failed, the second message is displayed and 'goto :eof' as you proposed. What do you think? |
I'm not sure that's necessary. I'd expect the prompt itself will be enough indication elevation is desired, if that's cancelled the message will indicate that elevation is required. @echo off
call @selfelevate "This batch requires administrator privileges."
:: Continue if elevated, or stop if the UAC prompt is Yes (running the elevated batch).
:: If the prompt is No stop, outputting the message (that'd be the default) to stderr. |
Mmm, I think you are right. Because can be achieved like this:
Thus, the prior message is displayed in the console if is desired, instead of a prompt. Also, I'm thinking in the way of the elevation, because EB allows load with rundll32 and regsvr32, maybe is possible to save with which application EB was loaded?. For use the same for request the elevation?. If was loaded with rundll32 request the elevation with rundll32, if it was loaded with regsvr32 request the load with regsvr32. |
I'm not quite sure what you're saying, there. I'm saying the call itself will test for elevation: if it is, it just exits and the batch continues; if not, it will run the batch as admin, which will give you the UAC prompt: if Yes, this batch pauses, runs the elevated version, then exits; if No, the message is displayed and it exits. There is no "instead of a prompt" - unless you're already admin or have disabled UAC you always get the prompt.
More work for no benefit. |
Oh @adoxa, now I understand it clearly. Is really a good approach. |
I think for security concerns is better to remove this feature. |
I removed the code for security concerns. |
Why do you remove this function without any discussion? I wrote you mail, but you may not read it, so I decide to write here. |
It wasn't necessary to remove it altogether, just always prompt. I'll eventually put it back, doing it that way, and adding the self command, so the batch itself is elevated. Don't know when, though. |
If it is removed temporary, till adoxa handle security issue, than OK for me. BTW: In the meantime, author of gsudo solve issue (reported by me) with situation if batch is started from mapped drive. So maybe take it in the account later, when this will be fixed.... |
What about to have a way to console self-elevate if needed? Not sure about implementation difficultness, but it will be really usefull.
https://github.com/gerardog/gsudo/blob/master/internals.md
The text was updated successfully, but these errors were encountered: