TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Look before you paste from a website to terminal

140 点作者 marcinkuzminski超过 8 年前

15 条评论

teh_klev超过 8 年前
This sort of <i>attack</i> has been discussed in great detail previously:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10554679" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10554679</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=5508225" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=5508225</a><p><a href="http:&#x2F;&#x2F;thejh.net&#x2F;misc&#x2F;website-terminal-copy-paste" rel="nofollow">http:&#x2F;&#x2F;thejh.net&#x2F;misc&#x2F;website-terminal-copy-paste</a>
M4v3R超过 8 年前
Not sure if this is iTerm2 or zsh, but I have to confirm the code I am pasting by pressing enter, which gives me an opportunity to review it first. I like this feature a lot.
评论 #13490986 未加载
评论 #13499950 未加载
评论 #13492077 未加载
评论 #13491510 未加载
评论 #13491440 未加载
annnnd超过 8 年前
Even more interesting: given the plethora of options terminals have for coloring, moving, erasing and similar, is it possible to hide malicious input from the shell too so that the victim is unaware of it?
评论 #13491486 未加载
martin-adams超过 8 年前
Here&#x27;s a question, could such an exploit be achieved using something like Stack Overflow?
评论 #13490494 未加载
评论 #13491183 未加载
评论 #13490780 未加载
评论 #13491027 未加载
评论 #13490394 未加载
stymaar超过 8 年前
What I usually do since I&#x27;ve been shown this kind of attack :<p>- Ctrl-X Ctrl-E: open the default text editor on your system<p>- paste your snipet here and review it<p>- save the snipet in your editor, it is now run.
godelski超过 8 年前
In zsh I can paste (or paste) into the browser (FF) I get<p>ls ; clear; echo &#x27;Haha! You gave me access to your computer with sudo!&#x27;; echo -ne &#x27;h4cking ## (10%)\r&#x27;; sleep 0.3; echo -ne &#x27;h4cking ### (20%)\r&#x27;; sleep 0.3; echo -ne &#x27;h4cking ##### (33%)\r&#x27;; sleep 0.3; echo -ne &#x27;h4cking ####### (40%)\r&#x27;; sleep 0.3; echo -ne &#x27;h4cking ########## (50%)\r&#x27;; sleep 0.3; echo -ne &#x27;h4cking ############# (66%)\r&#x27;; sleep 0.3; echo -ne &#x27;h4cking ##################### (99%)\r&#x27;; sleep 0.3; echo -ne &#x27;h4cking ####################### (100%)\r&#x27;; echo -ne &#x27;\n&#x27;; echo &#x27;Hacking complete.&#x27;; echo &#x27;Use GUI interface using visual basic to track my IP&#x27; ls -lat<p>Which seems like it would be pretty stupid for me to press enter. Which if we&#x27;re talking security it seems to more sane thing to do is not automatically send commands that are pasted in. Zsh being secure and bash not. I feel this is more a developer issue than user.
评论 #13494081 未加载
评论 #13492876 未加载
评论 #13494136 未加载
esseti超过 8 年前
this should be explited by stack overflow to have a counter on which lines were copied and how many times. With this counter one could know what&#x27;s the best answer used by many :)
Sean1708超过 8 年前
Bracketed paste and a vaguely half-decent terminal emulator will prevent this.
sly010超过 8 年前
I already paste everything longer than a single line to my non-terminal text editor (e.g. sublime) before I paste it to my terminal or vim. Perhaps I should start doing this for everything.
zupreme超过 8 年前
This is a valid danger but the author goes a bit far with the sudo warning. Unless you&#x27;re logged in as root to most systems (in which case sudo likely won&#x27;t be needed to screw your system up) using sudo would result in a password being requested which, I would hope, the user would see as a red flag, especially if they are technical enough to be locating and testing script snippets.
评论 #13492854 未加载
tyrylu超过 8 年前
Probably worthless tip, try browsing that code snippet with a screen reader. Yes, it is not hidden from that software. :-)
评论 #13491152 未加载
评论 #13491075 未加载
评论 #13490528 未加载
gigatexal超过 8 年前
Has anyone been burned by this? I&#x27;m going to start pasting things into a different text editor before running them.
评论 #13492109 未加载
marcinkuzminski超过 8 年前
Found another one here: <a href="http:&#x2F;&#x2F;thejh.net&#x2F;misc&#x2F;website-terminal-copy-paste" rel="nofollow">http:&#x2F;&#x2F;thejh.net&#x2F;misc&#x2F;website-terminal-copy-paste</a>
akerro超过 8 年前
Pfff should have just put forkbomb there.
bjt2n3904超过 8 年前
The &quot;fix&quot; to this problem is not to let your browser hook Ctrl+C. Mozilla, if you&#x27;re listening, could you perhaps make this an option? Or perhaps display a notice if you notice JS hook on Ctrl+C?
评论 #13491381 未加载
评论 #13491212 未加载
评论 #13491188 未加载