LinkedIn 工作邀请中的后门
A backdoor in a LinkedIn job offer

原始链接: https://roman.pt/posts/linkedin-backdoor/

一位软件工程师最近披露了一起精心设计的社会工程学攻击,该攻击伪装成合法的招聘流程。在领英(LinkedIn)上被一名“招聘人员”联系并要求协助排查一个加密货币初创项目的故障后,该作者产生了怀疑,选择在一个安全的隔离沙箱中检查代码库,而非在本地运行。 通过使用一个只读的 AI 代理,作者很快在测试文件中发现了一个隐藏的恶意后门。该代码被设计为在执行常见的开发安装步骤 `npm install` 时自动运行远程载荷。 进一步调查显示,整个操作——包括招聘人员的身份和仓库的提交记录——都是利用真实专业人士被盗用的身份伪造的。当作者与“招聘人员”对质时,对方表现出了不切实际的专业技术水平,证实了该请求的欺诈性质。 这起事件严厉提醒了开发者警惕“面试诱饵”类型的恶意软件。作者强调,即使是经验丰富的开发者也可能被此类诱饵迷惑,并主张在审查陌生代码时应保持严格的安全习惯,例如使用沙箱环境和自动化分析工具。

```Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 LinkedIn 招聘启事中的后门 (roman.pt) 35 分,作者:lwhsiao,31 分钟前 | 隐藏 | 过往 | 收藏 | 3 条评论 帮助 rektomatic 2 分钟前 | 下一条 [-] 我真的很想知道如果执行了 npm install 会发生什么,我猜是一些无聊的事情,比如挖矿或身份盗窃? 回复 CyanLite2 5 分钟前 | 上一条 | 下一条 [-] 这难道不是现在大多数 NPM 作者被黑的方式吗?我觉得 axios 的作者也是通过同样的方法在 LinkedIn 上被盯上的。 回复 theoeiffijr 8 分钟前 | 上一条 [-] 也许 Mac 终于能有一个像样的虚拟化框架了。像 1995 年那样从互联网上下载随机的、未受保护的脚本,这种做法很快就会过时。记住,在和陌生人见面并将他们的“垃圾”深入你的电脑时,记得做好防护! 回复 准则 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:```
相关文章

原文
A backdoor in a LinkedIn job offer

Last week, I got a LinkedIn message from a recruiter at a small crypto startup. We exchanged a few messages over a couple of days, she described a broken proof-of-concept they needed a lead engineer for, and then sent me a public GitHub repo to review. Specifically, she asked me to “check out the deprecated Node modules issue.”

It’s not uncommon to ask for a review of an existing codebase, but something felt off and raised an alarm in my head, so I decided to get a bit extra paranoid.

Instead of cloning and installing dependencies, I spun up a throwaway VPS on Hetzner, cloned the repo there, and pointed Pi at it in read-only mode, with only file-reading tools enabled:

pi --tools read,grep,find,ls

I asked the agent to review the codebase and flag anything suspicious. It stopped almost immediately at app/test/index.js.

The backdoor

The repo felt like a React frontend with a Node backend. The trap was in app/test/index.js, about 250 lines disguised as a test suite. Inside, a URL is assembled from fragments:

const protocol = "https",
  domain = "store",
  separator = "://",
  path = "/icons/",
  token = "77",
  subdomain = "rest-icon-handler",
  bearrtoken = "logo";

These combine into https://rest-icon-handler.store/icons/77.

Then, buried between walls of commented-out tests, the payload runs anything the server sends back to your machine.

The payload on a single minified line in app/test/index.js, surrounded by commented-out test code

The payload on line 225, hiding in plain sight between commented-out tests.

How it triggers

The file doesn’t wait for the tests to run. app/index.js itself executes const test = require('./test'), which loads and runs app/test/index.js.

package.json wires app/index.js into startup:

package.json scripts section with prepare and app:pre highlighted; app:pre runs node app/index.js

prepare runs app:pre, which is node app/index.js.

The prepare script is the important one. npm runs prepare automatically after npm install, so just installing dependencies executes the backdoor.

The instruction to “check out the deprecated Node modules issue” was bait to get me to run npm install.

I could have let the payload run in the sandbox and watched what the server sent back as the second stage, but I stopped there. A repo that runs whatever a server hands it was enough evidence.

A borrowed identity

The commits in the repo were authored under the name and email of a real developer, a full-stack engineer with an ordinary LinkedIn profile, a personal website, and a GitHub account with a long history. I messaged him, pretending I’d inherited the codebase and had a few implementation questions, to see how he’d react.

He told me he’d never worked for them. He’d been impersonated on GitHub before and had a repo taken down over it, and he had nothing to do with this one. He was reporting these repos too.

GitHub contributors graph showing a single contributor with 39 commits and 4,470 additions, name and avatar redacted

The whole commit history, 39 commits, attributed to one developer who’d never touched the repo.

A second borrowed identity

The recruiter’s profile belonged to a real arts journalist, a well-known one I looked up later, with a long cultural background and nothing technical on it. When I played along and told her I couldn’t get the project to install, the journalist instantly turned into an expert on npm and Node versions. It was quite amusing, I’d say.

LinkedIn chat where the recruiter insists the project runs fine on Node.js v24 and asks whether I ran npm install

The non-technical recruiter, suddenly debating Node versions and pushing me to run npm install.

This can happen to anyone

I’ve heard of these attacks and read about them on HN, but when one came after me it still caught me a bit off guard. I suspected something from the first few messages, but on a more tired or rushed day, I could easily have run npm install before thinking it through. So, if you get a LinkedIn message asking you to review a repo, a bit of paranoia and good security hygiene never hurts.

Another takeaway is that reviewing the code with a read-only agent turned out more productive than reading it myself. The backdoor was dressed up as sloppy beginner code, but the agent flagged it in seconds.

I reported the repo to GitHub and the recruiter to LinkedIn. So far nothing has changed and the code is still up.

联系我们 contact @ memedata.com