add why-this-works slide
This commit is contained in:
Binary file not shown.
@@ -117,10 +117,12 @@
|
|||||||
pragma solidity 0.4.25;
|
pragma solidity 0.4.25;
|
||||||
|
|
||||||
contract MyContract {
|
contract MyContract {
|
||||||
|
address private owner;
|
||||||
uint[] private arr;
|
uint[] private arr;
|
||||||
|
|
||||||
constructor() public {
|
constructor() public {
|
||||||
arr = new uint[](0);
|
arr = new uint[](0);
|
||||||
|
owner = msg.sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
function write(unit index, uint value) {
|
function write(unit index, uint value) {
|
||||||
@@ -192,6 +194,15 @@ contract MyContract {
|
|||||||
\end{lstlisting}
|
\end{lstlisting}
|
||||||
\end{frame}
|
\end{frame}
|
||||||
|
|
||||||
|
\begin{frame}[fragile]
|
||||||
|
\frametitle{Why this works}
|
||||||
|
A dynamic array in storage slot $p$ stores its data at continuous addresses starting at $keccak(p)$.
|
||||||
|
|
||||||
|
For example, if the variable $x$ is a dynamic array occupying storage slot 3, $x[o]$ can be found at $keccak(0x3)+o$.
|
||||||
|
|
||||||
|
An attacker can use this information to overwrite any storage slot by finding an appropriate offset value.
|
||||||
|
\end{frame}
|
||||||
|
|
||||||
\section{Detecting and Exploiting}
|
\section{Detecting and Exploiting}
|
||||||
\subsection[Detecting SWC-124]{Detecting SWC-124}
|
\subsection[Detecting SWC-124]{Detecting SWC-124}
|
||||||
\begin{frame}[fragile]
|
\begin{frame}[fragile]
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user