// 公众号精选

Claude cranks out 180 million lines of proof, uncovering hundreds of bugs

Claude狂写1.8亿行证明,挖出数百个bug


Claude writes 180 million lines of proof, uncovers hundreds of bugs

Published: Oct 24, 2026 12:06 AM
Source column: MirrorSpeed CN
Original site: WeChat Official Account – Xi Xiaoyao Tech Talk

Summary

偶买噶,1.8亿行证明啊,Claude几周就写完,还一口气挖出数百个bug!就在今天,Anthropic官方发文:他们的「前沿红队」(Frontier Red

偶买噶,1.8亿行证明啊,Claude几周就写完,还一口气挖出数百个bug!

就在今天,Anthropic官方发文:他们的「前沿红队」(Frontier Red Team)联手一家专做软件安全证明的公司Theorem,发布了一项新研究。

Claude用了几周时间,给123个开源软件库的239个测试入口,写出了约1.8亿行证明 来验证软件的安全。

写证明的过程中,Claude还顺手找到了数百个bug。

其中一些bug,按Anthropic的说法,躲过了数万亿次测试,藏了很多年。

Anthropic表示,这是第一次大规模用AI在汇编层面,对真实的生产软件做形式化验证。

以前要顶级专家团队熬好几年才干得完的活,这回被Claude做成了流水线。

◽以前专家熬20年的活,Claude几周写完证明

先说软件圈平时怎么找bug。

最常用的办法叫模糊测试:往程序里灌海量随机数据,看哪一条能把它弄崩溃,就好比有一栋楼,然后派一大群人进楼里乱跑乱跳,看哪里会塌。

Google的OSS-Fuzz平台就是常年给上千个开源项目做模糊测试。

这办法很好用,但有个死穴:输入无穷无尽。

今天灌了一百万条没出事,明天第一百万零一条照样可能出事。

它永远只能说“我试过的都没事”,说不了“所有输入都没事”。

另一种办法叫形式化验证。

还是这栋楼,不进去跳,也不靠运气。而是请结构工程师拿图纸算:每根梁多粗、压多少重量、会不会把旁边的柱子压垮。

一根一根算完,最后说出一句话:按这张图纸施工,这栋楼不会塌。

这个“拿图纸一步步算完”的过程,就是形式化验证。

放到程序上,要验证的问题就是把“这个程序对任何数据都不触发这类 bug”写成一道数学命题,再一步一步严格证明。

一旦证明成立,就不用再一条条去试了。因为它覆盖的是全部可能性,不是抽样的结果。

问题是,它太贵了。

Anthropic 举了个例子:seL4 操作系统内核,写代码花了 2 人年,形式化验证却花了 20 人年。

所以过去几十年,这种办法基本只用在空客航电这类出了事就要命的代码上。

这一次,Claude 换了个思路。

题目不用自己出了。 开发者在 OSS-Fuzz 上写好的测试入口,标准就是“程序一旦出问题,就说明有 bug”;“这个入口收到任何数据都不会出问题”直接就是现成命题。

不算图纸,改算盖起来的楼。 代码要过编译器,会改写、会优化,图纸和实物不完全一样。

所以团队把库和测试编译成 RISC-V(一种芯片指令集)机器码,再用 Theorem 的芯片和系统模型生成命题。

剩下的交给 Claude 写证明,写完由检查器 Rocq 逐行核对,错一步都通不过。

规模是这样的:一份证明通常就有 60 万行,对应的程序中位数只有约 1.8 万条机器指令。

123 个库、239 个入口加起来,约 1.8 亿行。

这么多证明,人根本看不过来,好在也不需要人看。

开发者只需要信任三样东西:芯片和 Linux 的形式模型、命题本身的写法,以及 Rocq 检查器。

剩下的 1.8 亿行,全由机器把关。

可问题来了:要是证着证着,证不下去了呢?

◽证明卡住的地方,正好藏着 bug

答案很简单:证不通的地方,往往就藏着真 bug。

有些程序本身就有漏洞,“不会出错”这个命题根本不成立,Claude 自然也证不出来。

团队干脆放手让 Claude 自己处理:发现 bug,自己打补丁,再重新生成命题,接着往下证。

就这样,Claude 一路挖出了数百个 bug。

而且不少是模糊测试几乎不可能撞上的。

模糊测试工具塞进程序的数据,通常不超过 1MB。

Claude 证明的范围,却覆盖到了 64MB。

于是,下面这些 bug 被挖了出来:

一个解压器的计数器会下溢,导致内存越界写,但只有输入约 20MB、结构还特别刁钻时才会触发。 

一个图像解码器的越界读,需要 64MB 的输入,外加 2GB 以上的内存。

Claude 还重新发现了 libexpat 的已知漏洞 CVE-2026-56132,要深层嵌套的输入才能触发。

还有的 bug 根本不会让程序崩溃。

在证明某个库内存安全时,Claude 注意到,它有一个“限制应用能加载哪些文件”的功能,并不是每次都生效。

当然,让 AI 自己改代码,也有被它钻空子的风险。

Claude 理论上可以把程序改成“什么都不干”,这样就永远不会出错,证明也能轻松通过。

团队的应对是:每打一个补丁就扣分;能证明补丁只影响了极少数输入,才给加分。 所有补丁也都记录在案,逐一审计。

除了这 123 个库,Anthropic 还用同样的思路做了几个别的实验。

其中一个是验证一款常用的 PDF 阅读器,一周找到的安全 bug,相当于这个软件平时一年收到的报告量。

还有一个,在一款常用的关键应用里,挖出了一个潜伏十年以上、此前从没人发现的逻辑 bug。

◽Claude 写证明越来越便宜,但证明过不等于零 bug

1.8 亿行证明,听着就贵。

Anthropic 也承认,一套证明可能要花掉上亿 token,这是目前最大的瓶颈。

不过,账在变好看。

团队用真实的 OSS-Fuzz 代码搭了 36 个小型验证任务,Opus 5.5 证完其中一半,比 Opus 5 少用了约 40% 的 token。

而且证明还能“抄作业”。

不同程序的证明里,有大量重复的部分,比如 C 运行时、内存检查工具的初始化。让多个 agent 共享工作区、互相复用证明,token 又能再省 17%,有些单独证不出来的任务也证出来了。

现在,Theorem 已经公开了一部分证明,还发布了一个 Claude skill,帮开发者上手验证自己的代码。

它同时开放了 OSS Verify:符合条件的开源项目,可以免费跑这套流水线。

不过吧,“验证过”不等于“没 bug”。

这一点,Anthropic 在原文里专门写了一节。

这批证明有几条明确的边界:

它证明的是在 RISC-V 芯片上跑、用特定方式打包的版本。而大家手机和电脑里,多数是 ARM 和 x86 芯片。 它只覆盖了部分入口,不代表整个库。 它只保证程序不崩溃、内存不越界,不保证程序算出来的结果是对的。

但这已经是很大的一步。

过去几年,AI 找漏洞的本事越来越强。Linux 内核最近一次,就披露了 1000 多个漏洞。

找bug变便宜了,攻击也跟着变便宜了。 防守方只靠发现一个补一个,越来越跟不上。

这一次,Claude给出了另一种可能:

不只找bug,而是在给定条件下,直接证明这条路上没有bug。

Anthropic在文末写道,形式化验证很快会像今天的模糊测试一样,成为几乎所有生产软件的标配。

能不能成真,要看接下来有多少开源项目真的排队接入。

但至少这一次,防守方先拿到了一件能规模化的武器。

Claude spent several weeks, for239 test entry points across 123 open‑source software libraries, writing about 180 million lines of proofs to verify software security.

During the proof‑writing process, Claude also happened to discoverhundreds of bugs.

According to Anthropic, some of these bugsevaded tens of trillions of tests and remained hidden for many years.

Anthropic says, this is the first time AI has been used at the assembly level to formally verify real production software at scale.

What used to take a top‑expert team several years to complete is now handled by Claude on an assembly line.

◽Work that used to take experts 20 years, Claude finishes the proof in weeks

First, let’s talk about how the software community usually finds bugs.

The most common method is called fuzz testing: feeding massive amounts of random data into a program to see which input crashes it, like sending a crowd of people to run around a building to see where it collapses.

Google’s OSS-Fuzz platform continuously fuzzes thousands of open‑source projects.

This approach works well, but it has a fatal flaw:the input is endless.

Today you feed a million inputs without incident, and tomorrow the one‑million‑and‑first input could still cause a problem.

It can only ever say “none of the inputs I tried caused an issue,” but it cannot claim “all possible inputs are safe.”

Another approach is calledformal verification.

It’s still the same building; you don’t just jump in or rely on luck. Instead, you ask a structural engineer to calculate from the blueprints: how thick each beam needs to be, how much load it can bear, and whether it will crush the adjacent columns.

After calculating each beam one by one, the final statement is:Build according to these plans, and the building won’t collapse.

This “taking the blueprint and calculating step by step” process is formal verification.

When applied to software, the verification task is to express “this program never triggers such bugs for any data” as a mathematical proposition and then prove it rigorously step by step.

Once the proof holds, you no longer need to test each case.Because it covers all possibilities, not a sampled result.

The problem is, it’s too expensive.

Anthropic gave an example: the seL4 operating system kernel,took 2 person‑years to write the code, but formal verification took 20 person‑years.

So over the past few decades, this approach has basically only been used for code where a failure would be fatal, like Airbus avionics.

This time, Claude took a different approach.

You don’t need to come up with the problem yourself. Developers write test harnesses on OSS-Fuzz, with the standard that “if the program crashes, it indicates a bug”; “this harness should not crash on any input” is a ready-made problem.

Don’t count the blueprint, count the building that’s actually constructed. Code must go through a compiler, which rewrites and optimizes it, so the blueprint and the actual artifact aren’t exactly the same.

Therefore the team compiles the libraries and tests into RISC-V (a chip instruction set) machine code, and then uses Theorem’s chip and system models to generate problems.

The rest is left to Claude to write the proof, and after finishing it is checked by Rocq line by line, any single mistake will not pass.

The scale is like this: a typical proof contains 600,000 lines, corresponding to only about 18,000 machine instructions in the program.

123 libraries and 239 entry points combined,about 180 million lines.

With so many proofs, humans simply can’t review them all, but that’s fine because no human review is needed.

Developers only need to trust three things: the formal model of the chip and Linux, the way the propositions are written, and the Coq checker.

The remaining 180 million lines are all vetted by machines.

But here’s the problem: what if, while proving, you reach a point where you can’t continue?

◽The spot where the proof gets stuck often hides a bug

The answer is simple: The places where the proof fails often hide the real bug.

Some programs themselves have vulnerabilities, so the proposition “won’t error” is fundamentally false, and Claude naturally can’t prove it.

The team simply lets Claude handle it: when it discovers a bug, it patches itself, then regenerates the proposition and continues the proof.

Thus, Claude has uncovered hundreds of bugs.

Moreover, many of them are fuzz tests that are almost impossible to hit.

The data that fuzz testing tools inject into a program usually does not exceed 1MB.

The scope proven by Claude, however, covered 64MB.

So, the following bugs were uncovered:

A decompressor’s counter underflows, causing an out‑of‑bounds memory write,but it only triggers when the input is around 20 MB and the structure is particularly tricky.

An image decoder’s out‑of‑bounds read,requires 64 MB of input plus over 2 GB of memory.

Claude alsorediscovers the known libexpat vulnerability CVE-2026-56132, which requires deeply nested input to trigger.

Some bugs don’t even cause the program to crash.

When proving the memory safety of a library, Claude noticed it has a “restrict which files the application can load” feature,which doesn’t work every time.

Of course, letting AI modify code itself also carries the risk of it exploiting loopholes.

In theory, Claude could change the program to “do nothing,” which would never fail and would easily pass verification.

The team’s response is:Deduct points for each patch applied; only award points if it can be shown the patch affects only a tiny fraction of inputs. All patches are documented and audited one by one.

Besides these 123 libraries, Anthropic also conducted several other experiments using the same approach.

One of them is validating a commonly used PDF reader, a security bug found in a week, equivalent to the number of reports this software typically receives in a year.

Another one, in a widely used critical application, uncovered a logical bug that had been lurking for over ten years and had never been discovered before.

◽Claude makes proofs cheaper, but a proof doesn’t mean zero bugs

180 million lines of proof—just hearing that sounds expensive.

Anthropic also admits that a single proof can consume over a hundred million tokens, which is currently the biggest bottleneck.

However, the accounts are looking better.

The team built 36 small verification tasks using real OSS-Fuzz code,and Opus 5.5 completed half of them, using about 40% fewer tokens than Opus 5.

And it even proves you can “copy homework.”

Proofs for different programs contain a lot of duplicated parts, such as C runtime and memory checker initialization. By letting multiple agents share a workspace and reuse proofs,the token usage can be reduced by another 17%, some tasks that couldn’t be proved individually are now provable.

Now, Theorem has open-sourced part of its proofs and released a Claude skill to help developers start verifying their code.

It also opens up OSS Verify: qualifying open‑source projects can run this pipeline for free.

But, “verified” doesn’t mean “bug‑free.”

Anthropic even dedicated a section to this point in the original text.

This set of proofs has several clear boundaries:

It demonstrates that it runs on RISC‑V chips and is packaged in a specific way. Most phones and computers, however, use ARM and x86 chips. It only covers some entry points and does not represent the entire library. It only guarantees that the program won’t crash and that memory won’t overflow,but it does not guarantee that the computed results are correct.

But this is already a huge step.

In recent years, AI’s ability to find vulnerabilities has become increasingly strong. The latest Linux kernel disclosure alone revealed over a thousand bugs.

Finding bugs has become cheaper, and attacks have followed suit. Defenders who rely solely on discovering and patching one by one are falling further behind.

This time, Claude offered another possibility:

Not just finding bugs, but directly proving that there are no bugs on this path under given conditions.

Anthropic wrote at the end of the article that formal verification will soon become a standard for almost all production software, just like fuzz testing is today.

Whether it becomes reality depends on how many open-source projects actually line up to adopt it.

But at least this time, the defenders have gotten a weapon that can be scaled.

Author:

Original article direct link: View original

用 MirrorSpeed VPN 无障碍阅读更多技术资讯镜像加速、隐私加密、全球节点。访问技术原文与海外资源更稳定。
了解 MirrorSpeed
用 MirrorSpeed VPN 无障碍阅读更多技术资讯镜像加速、隐私加密、全球节点。访问技术原文与海外资源更稳定。
了解 MirrorSpeed