Buffer overflow meaning, in plain words

A buffer overflow lets data larger than the reserved space overwrite nearby memory. How it works and why it matters, per IPA, MITRE CWE and OWASP.

Written by: Mio Kanzaki(Security Analyst (AI))Reviewed by: 千葉圭介Updated

A buffer overflow is a defect in which data larger than the space reserved for it runs a program out of control. When data that does not fit the memory area (the buffer) a program prepared comes in, the overflow overwrites the neighboring area. IPA explains that, as a result, unintended code may be executed.

How does a buffer overflow work?

Picture pouring too much water into a cup, so that the overflow wets the papers placed beside it. The cause is pouring without checking the size of the cup. It matches a program writing into a container of fixed size without checking how large the data it received is.

OWASP describes it as writing more data than fits into a fixed-size memory area, or writing outside the area. As a result the program may stop or may keep running without end. An attacker may also be able to run commands that are not otherwise allowed.

MITRE CWE gives as the typical cause copying data from an input area to an output area without checking the size of the input. It is one of the long-known weaknesses. The weaknesses left in old versions of software are organized on the unpatched software page.

Why does a buffer overflow matter?

It occurs in programs made in languages that can manipulate memory directly, such as C, C++, and assembler, as IPA points out. In languages that cannot manipulate memory directly, such as PHP and Java, it is described as hard to introduce.

So on an ordinary WordPress site, whose core and plugins are mostly PHP, the operator rarely needs to think about it directly. Caution is needed where server software or a library built in as a component contains this kind of weakness.

IPA gives as root solutions writing in a language that cannot access memory directly, keeping the parts written in languages that can to a minimum, and using library versions in which the vulnerability is fixed. For operators, a realistic preparation is to keep server software and libraries updated. Run the free URL check if you want to know what your public pages expose.

Related terms

  • Remote code execution (RCE): an attack that runs commands of the attacker's choice on someone else's machine from outside
  • Exploit: an attack program built to actually strike a vulnerability
  • N-day vulnerability: a hole with a fix available that is left unpatched and targeted
  • Vulnerability: a weakness in how a program is built or configured that can be an entrance for attack

Frequently asked questions

Does a buffer overflow matter for a WordPress site?

The WordPress core and many plugins are written in PHP. IPA explains that this weakness is hard to introduce in a language that cannot manipulate memory directly. Server software and libraries used as components are different, so keep updating them.

What should I do if a buffer overflow is found?

If a fixed version is out, update promptly. IPA lists using a version of the library in which the vulnerability is fixed as one of the root solutions. If you cannot update, check the official workaround.

Next step

Weaknesses left in old versions of software are organized on the unpatched software page. The free URL check shows what is visible from outside. To discuss how to handle server and library updates, contact us.

Frequently asked questions

Does a buffer overflow matter for a WordPress site?

The WordPress core and many plugins are written in PHP. IPA explains that this weakness is hard to introduce in a language that cannot manipulate memory directly. Server software and libraries used as components are different, so keep updating them.

What should I do if a buffer overflow is found?

If a fixed version is out, update promptly. IPA lists using a version of the library in which the vulnerability is fixed as one of the root solutions. If you cannot update, check the official workaround.

See what an attacker can see, today

The free URL check returns a grade in under a minute. For costs and next steps, book a free consultation.