TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Hacking with environment variables

226 pointsby pentestercrabalmost 5 years ago

9 comments

awirthalmost 5 years ago
See also the sudo bad environment variable list[1], which I recently found a 15 year old typo in.[2]<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;sudo-project&#x2F;sudo&#x2F;blob&#x2F;master&#x2F;plugins&#x2F;sudoers&#x2F;env.c#L138" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sudo-project&#x2F;sudo&#x2F;blob&#x2F;master&#x2F;plugins&#x2F;sud...</a> [2]: <a href="https:&#x2F;&#x2F;www.sudo.ws&#x2F;repos&#x2F;sudo&#x2F;rev&#x2F;bdf9c9e7f455" rel="nofollow">https:&#x2F;&#x2F;www.sudo.ws&#x2F;repos&#x2F;sudo&#x2F;rev&#x2F;bdf9c9e7f455</a>
评论 #23828945 未加载
shanemhansenalmost 5 years ago
I did something like this once. My University had an full screen kiosk browser that was locked down. Well it turns out that you could &quot;customize&quot; Firefox, add in a missing button, get to the print screen and change the executable from &quot;lpr&quot; to $TERM which would immediately pop a shell.<p>Good times.
评论 #23836099 未加载
lunixbochsalmost 5 years ago
This was a huge component of a 2020 DEFCON CTF qualifier challenge that only Samurai and PPP solved, where you had to get code execution or arbitrary file read out of as many setuid binaries as possible, after installing basically every cli Debian package and changing them to setuid.<p>There are some very interesting ways to load shared objects or read files with environment variables, and we even found ways to leverage common libraries like readline and gconv to pop apps that used them.
评论 #23830559 未加载
评论 #23828991 未加载
评论 #23829378 未加载
评论 #23829568 未加载
RcouF1uZ4gsCalmost 5 years ago
&gt;An unexpected exception to this is the antigravity module. The Python developers included an easter egg in 2008 which can be triggered by running import antigravity. This import will immediately open your browser to the xkcd comic that joked that import antigravity in Python would grant you the ability to fly.<p>&gt; As for how the antigravity module opens your browser, it uses another module from the standard library called webbrowser. This module checks your PATH for a large variety of browsers, including mosaic, opera, skipstone, konqueror, chrome, chromium, firefox, links, elinks and lynx. It also accepts an environment variable BROWSER that lets you specify which process should be executed.<p>It was the possibility of security vulnerabilities that made software companies (more specifically Microsoft[0]) eschew easter eggs. Every feature, every line of code potentially increases your attack surface, especially if it interacts with other features.<p>0. <a href="https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;archive&#x2F;blogs&#x2F;larryosterman&#x2F;why-no-easter-eggs" rel="nofollow">https:&#x2F;&#x2F;docs.microsoft.com&#x2F;en-us&#x2F;archive&#x2F;blogs&#x2F;larryosterman...</a>
评论 #23828141 未加载
评论 #23830008 未加载
评论 #23828135 未加载
评论 #23828225 未加载
评论 #23829984 未加载
评论 #23828142 未加载
mmastracalmost 5 years ago
&gt; A generic solution for Ruby has not been found yet. Ruby does accept an environment variable RUBYOPT to specify command-line options. The man page states that RUBYOPT can contain only -d, -E, -I, -K, -r, -T, -U, -v, -w, -W, --debug, --disable-FEATURE and --enable-FEATURE. The most promising option is -r which causes Ruby to load the library using require. However, this is limited to files with an extension of .rb or .so.<p>Interesting - could the -r option load a .so file with a .ctor section?
评论 #23828311 未加载
xuchengalmost 5 years ago
I understand this kind of techniques were common to attack unsafe CGI web servers in the old time.<p>I wonder whether it is still the case nowadays. Is CGI still being used?
评论 #23830276 未加载
评论 #23829843 未加载
teddyhalmost 5 years ago
Regarding Python scripts: All Python scripts runnable by more than one user should really have the “-I” option on the shebang line; this, among other things, ignores all PYTHON* environment variables. (Note: Python 3 only.)
评论 #23832313 未加载
mkesperalmost 5 years ago
When you control environment variables, can&#x27;t you also LDPRELOAD scary stuff?
评论 #23829285 未加载
评论 #23829371 未加载
svnpennalmost 5 years ago
Warning, website wont load at all unless JavaScript is enabled.
评论 #23830132 未加载
评论 #23829155 未加载
评论 #23828477 未加载
评论 #23829521 未加载