# Stack Canaries

<details>

<summary>Table of Contents</summary>

* History
* The Program
* Examining Stack Canaries
* Bypassing Stack Canaries
* References

</details>

## History

{% hint style="warning" %}
This section, although fascinating and insightful, is a *little* long. Skip here to the actual computer-related stuff if you're a boring nerd who doesn't care about lore.
{% endhint %}

At the dawn of the early 1900s—amid the Second Industrial Revolution, coal mining saw many advancements with the rise of widespread railway expansions, locomotives, and steam engines. These innovations enabled miners to delve deeper into the earth, reaching areas previously thought inaccessible. However, with these advancements came increased exposure to dangerous gases lurking within the mines, unbeknownst to many miners.

> "The main toxic gases in mines are carbon monoxide (`CO`) and carbon dioxide (`CO2`); the flammable gases are methane (`CH4`), `CO`, and hydrogen (`H2`); the suffocating gases are `CO2`, nitrogen (`N20`), and `CH4`; and the toxic gases are `CO`, nitrogen oxides (`NOx`), and hydrogen sulfide (`H2S`)."
>
> — [Respiratory Emergencies and Management of Mining Accidents](https://pmc.ncbi.nlm.nih.gov/articles/PMC5783100/), Özmen, İ., & Aksoy, E. (2015)

These gases posed a grave danger to miners, threatening both their safety and more importantly to many, their ability to perform their work. To address this, miners needed a reliable way to detect toxic gas concentrations before they perished. In 1906, they found their solution—albeit one that was a little *unorthodox* and, by today’s standards, ethically *questionable*. During this time, a newspaper article came out a couple of days before Christmas telling of a rescue party that had used a very innocuous *bird* to determine when toxic gas concentrations were getting dangerously high:

<figure><img src="/files/V6Vah9fvZpXy1PoeO37e" alt=""><figcaption><p>“New Use for the Canary.” Nottingham Evening Post, 21 Dec. 1906, p. 4. British Library Newspapers</p></figcaption></figure>

> "Afterdamp is the toxic mixture of gases left in a mine following an explosion caused by [methane](https://en.wikipedia.org/wiki/Methane)-rich [firedamp](https://en.wikipedia.org/wiki/Firedamp), which itself can initiate a much larger explosion of [coal dust](https://en.wikipedia.org/wiki/Coal_dust)."
>
> — [Afterdamp](https://en.wikipedia.org/wiki/Afterdamp), Wikipedia

Well, then, this begs the following question: "Why the canaries specifically? Why not some other bird?" Canaries, due to their anatomy, are *very* sensitive to toxic gases and thus make a "perfect" warning indicator for them. However, very often, they had to be revived from being exposed to these gases and other times, they straight up just died during this practice. This happened so much that new types of cages were made and some miners were even reported bringing vials of oxygen to resuscitate the poor bird.

> "The combination of the bird’s rapid breathing rate, small size and high metabolism made it highly responsive to dangerous gases, especially carbon monoxide. The signal a canary provided would give miners enough time to escape or put on respirators. Eventually, a special type of birdcage with ventilation holes was developed \[as shown in the picture below]. When the bird fell off the perch inside the cage, miners closed an airtight door over the ventilation holes and revived the bird with oxygen, so the bird could be used again. Some miners were said to have even carried small vials of oxygen with them so that they could revive a poisoned bird."
>
> — [Canaries in the Coal Mine](https://history.alberta.ca/energyheritage/coal/the-early-development-of-the-coal-industry-1874-1914/early-methods-and-technology/canaries-in-the-coal-mine.aspx), Alberta's Energy Heritage

<figure><img src="/files/OzX6Ff7GXvwOBfUTa0NG" alt=""><figcaption><p>This <em>horrific</em> abomination of God is called the "canary resuscitator"</p></figcaption></figure>

If you'd like to read more about the fascinating subject of mining canaries, I recommend the following articles:

{% embed url="<https://review.gale.com/2020/09/08/canaries-in-the-coal-mine/>" %}

{% embed url="<https://history.alberta.ca/energyheritage/coal/the-early-development-of-the-coal-industry-1874-1914/early-methods-and-technology/canaries-in-the-coal-mine.aspx>" %}

## The Program

### Canaries In Action

## Examining Stack Canaries

## Bypassing Stack Canaries

## References


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://archive.crow.rip/nest/binexp/sec/stack-canaries.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
