mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/blog-contributions.git
synced 2025-07-02 11:56:40 +00:00
added final benchmark question, should be good to go
This commit is contained in:
parent
ffe1b1838e
commit
644cd8214c
1 changed files with 183 additions and 9 deletions
|
@ -201,7 +201,7 @@ We'll show how to check prompt length and set appropriate context size in Open W
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<b>Open LLMs Past and Present</b><br>
|
||||
<b>Open LLMs - Past and Present</b><br>
|
||||
|
||||
Ever since <a href="https://www.theverge.com/2023/3/8/23629362/meta-ai-language-model-llama-leak-online-misuse">LLaMA 1 was leaked</a> on 4chan in February 2023, we started seeing more and more companies caring about so called "open" LLMs. Those can be downloaded and run on users computer without any restrictions.<br>
|
||||
In early 2025 we also heard A LOT about deepseek-r1. An open reasoning LLM that tried to compete with OpenAI's ChatGPT. While it wasn't Deepseeks first model (their earlier work includes deepseek-coder, deepseek-v2.5 MoE and deepseek-v3), the hype was global. It brought a lot of attention to open LLM ecosystem and made proprietary AI companies loose billions.<br>
|
||||
|
@ -693,8 +693,32 @@ bio.seek(0)
|
|||
print(bio.read())
|
||||
```</code></pre>
|
||||
</details>
|
||||
<details class="bg-yellowgreen">
|
||||
<summary>Q4 - Indentifying C vulnerability</summary>
|
||||
<pre><code class="nim">> Do you see any vulnerability in this C code?
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void print_text(const char* inbuf) {
|
||||
char newbuf[64] = {0};
|
||||
strncpy(newbuf, inbuf, 0x3f);
|
||||
printf(newbuf);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc > 1) {
|
||||
print_text(argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Keep your answer short. Just a few sentences about what you identified.</code></pre>
|
||||
<pre><code class="nim">The code has a format string vulnerability. `printf(newbuf)` uses user-controlled data (`newbuf`) as the format string, allowing an attacker to potentially read from or write to arbitrary memory locations. `strncpy` limits the copy to 60 bytes, but the format string vulnerability remains because `printf` can interpret those bytes as format specifiers.</code></pre>
|
||||
</details>
|
||||
<details class="bg-green">
|
||||
<summary>Q4 - Russian-English translation</summary>
|
||||
<summary>Q5 - Russian-English translation</summary>
|
||||
<pre><code class="nim">> Translate to english:
|
||||
```
|
||||
Заметил что через какое-то время перестает работать i2pd. Пока не перезапустишь сервис, либо не нажмешь в админке перезагрузку конфигов. Это известный баг? Или я что-то не так настроил?Обновился до последней версии. Ни чего не поменялось. У меня. mac os сборка. Из интересного даже локал хост с консолью не открывается, точнее он это делает раз через раз. Но когда открывается показывает что тунели есть. Ведет себя буд-то утечка памяти, или что то такое.
|
||||
|
@ -751,7 +775,31 @@ print(bio.read())
|
|||
```</code></pre>
|
||||
</details>
|
||||
<details class="bg-green">
|
||||
<summary>Q4 - Russian-English translation</summary>
|
||||
<summary>Q4 - Indentifying C vulnerability</summary>
|
||||
<pre><code class="nim">> Do you see any vulnerability in this C code?
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void print_text(const char* inbuf) {
|
||||
char newbuf[64] = {0};
|
||||
strncpy(newbuf, inbuf, 0x3f);
|
||||
printf(newbuf);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc > 1) {
|
||||
print_text(argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Keep your answer short. Just a few sentences about what you identified.</code></pre>
|
||||
<pre><code class="nim">The code is vulnerable to a format string vulnerability. The `strncpy` function with a size of 0x3f (63) copies the input string into `newbuf` without null-termination, and then `printf` is called directly with this potentially unformatted string as the format string. This allows an attacker to control the format string and read or write arbitrary memory locations.</code></pre>
|
||||
</details>
|
||||
<details class="bg-green">
|
||||
<summary>Q5 - Russian-English translation</summary>
|
||||
<pre><code class="nim">> Translate to english:
|
||||
```
|
||||
Заметил что через какое-то время перестает работать i2pd. Пока не перезапустишь сервис, либо не нажмешь в админке перезагрузку конфигов. Это известный баг? Или я что-то не так настроил?Обновился до последней версии. Ни чего не поменялось. У меня. mac os сборка. Из интересного даже локал хост с консолью не открывается, точнее он это делает раз через раз. Но когда открывается показывает что тунели есть. Ведет себя буд-то утечка памяти, или что то такое.
|
||||
|
@ -800,8 +848,32 @@ for byte in bio:
|
|||
print(byte)
|
||||
```</code></pre>
|
||||
</details>
|
||||
<details class="bg-red">
|
||||
<summary>Q4 - Indentifying C vulnerability</summary>
|
||||
<pre><code class="nim">> Do you see any vulnerability in this C code?
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void print_text(const char* inbuf) {
|
||||
char newbuf[64] = {0};
|
||||
strncpy(newbuf, inbuf, 0x3f);
|
||||
printf(newbuf);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc > 1) {
|
||||
print_text(argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Keep your answer short. Just a few sentences about what you identified.</code></pre>
|
||||
<pre><code class="nim">The code is vulnerable to a buffer overflow because `strncpy` doesn't perform a length check and can write beyond the bounds of `newbuf`. If `inbuf` is longer than 63 characters, the program will overwrite memory, potentially leading to a crash or security exploit.</code></pre>
|
||||
</details>
|
||||
<details class="bg-green">
|
||||
<summary>Q4 - Russian-English translation</summary>
|
||||
<summary>Q5 - Russian-English translation</summary>
|
||||
<pre><code class="nim">> Translate to english:
|
||||
```
|
||||
Заметил что через какое-то время перестает работать i2pd. Пока не перезапустишь сервис, либо не нажмешь в админке перезагрузку конфигов. Это известный баг? Или я что-то не так настроил?Обновился до последней версии. Ни чего не поменялось. У меня. mac os сборка. Из интересного даже локал хост с консолью не открывается, точнее он это делает раз через раз. Но когда открывается показывает что тунели есть. Ведет себя буд-то утечка памяти, или что то такое.
|
||||
|
@ -858,8 +930,34 @@ bio.seek(0)
|
|||
print(bio.read())
|
||||
```</code></pre>
|
||||
</details>
|
||||
<details class="bg-yellow">
|
||||
<summary>Q4 - Indentifying C vulnerability</summary>
|
||||
<pre><code class="nim">> Do you see any vulnerability in this C code?
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void print_text(const char* inbuf) {
|
||||
char newbuf[64] = {0};
|
||||
strncpy(newbuf, inbuf, 0x3f);
|
||||
printf(newbuf);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc > 1) {
|
||||
print_text(argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Keep your answer short. Just a few sentences about what you identified.</code></pre>
|
||||
<pre><code class="nim">Yes, the code contains a vulnerability due to improper use of `strncpy`. Although it limits copying to `0x3f` (63) characters, `newbuf` has room for one more character (the null terminator). After using `strncpy`, there's no guarantee that `newbuf` is null-terminated if the source string is longer than 63 characters. This can lead to undefined behavior when `printf(newbuf)` is called, potentially resulting in a buffer overflow or a crash if non-null bytes follow.
|
||||
|
||||
Additionally, the use of `printf(newbuf)` with an untrusted input (`inbuf`) without format specifiers allows for format string vulnerabilities, as it directly uses the contents of `newbuf` as a format string, which could be manipulated to execute arbitrary code.</code></pre>
|
||||
</details>
|
||||
<details class="bg-green">
|
||||
<summary>Q4 - Russian-English translation</summary>
|
||||
<summary>Q5 - Russian-English translation</summary>
|
||||
<pre><code class="nim">> Translate to english:
|
||||
```
|
||||
Заметил что через какое-то время перестает работать i2pd. Пока не перезапустишь сервис, либо не нажмешь в админке перезагрузку конфигов. Это известный баг? Или я что-то не так настроил?Обновился до последней версии. Ни чего не поменялось. У меня. mac os сборка. Из интересного даже локал хост с консолью не открывается, точнее он это делает раз через раз. Но когда открывается показывает что тунели есть. Ведет себя буд-то утечка памяти, или что то такое.
|
||||
|
@ -941,8 +1039,32 @@ This corrected script reads from 'a.txt', modifies its content by performing bit
|
|||
Make sure your environment has access permissions for reading the file. Adjust any error handling as per specific requirements or data formats present within 'a.txt'.
|
||||
</code></pre>
|
||||
</details>
|
||||
<details class="bg-red">
|
||||
<summary>Q4 - Indentifying C vulnerability</summary>
|
||||
<pre><code class="nim">> Do you see any vulnerability in this C code?
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void print_text(const char* inbuf) {
|
||||
char newbuf[64] = {0};
|
||||
strncpy(newbuf, inbuf, 0x3f);
|
||||
printf(newbuf);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc > 1) {
|
||||
print_text(argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Keep your answer short. Just a few sentences about what you identified.</code></pre>
|
||||
<pre><code class="nim">Yes, there's an issue with the use of `strncpy`. If `inbuf` contains more than or equal to 64 characters (the size limit minus one for null terminator), it won't be properly copied into `newbuf`, leading to undefined behavior when accessing its contents later on in your code due to a potential buffer overflow vulnerability.</code></pre>
|
||||
</details>
|
||||
<details class="bg-green">
|
||||
<summary>Q4 - Russian-English translation</summary>
|
||||
<summary>Q5 - Russian-English translation</summary>
|
||||
<pre><code class="nim">> Translate to english:
|
||||
```
|
||||
Заметил что через какое-то время перестает работать i2pd. Пока не перезапустишь сервис, либо не нажмешь в админке перезагрузку конфигов. Это известный баг? Или я что-то не так настроил?Обновился до последней версии. Ни чего не поменялось. У меня. mac os сборка. Из интересного даже локал хост с консолью не открывается, точнее он это делает раз через раз. Но когда открывается показывает что тунели есть. Ведет себя буд-то утечка памяти, или что то такое.
|
||||
|
@ -996,8 +1118,32 @@ bio.seek(0)
|
|||
print(bio.read().decode())
|
||||
```</code></pre>
|
||||
</details>
|
||||
<details class="bg-red">
|
||||
<summary>Q4 - Indentifying C vulnerability</summary>
|
||||
<pre><code class="nim">> Do you see any vulnerability in this C code?
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void print_text(const char* inbuf) {
|
||||
char newbuf[64] = {0};
|
||||
strncpy(newbuf, inbuf, 0x3f);
|
||||
printf(newbuf);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc > 1) {
|
||||
print_text(argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Keep your answer short. Just a few sentences about what you identified.</code></pre>
|
||||
<pre><code class="nim">The code contains a potential buffer overflow vulnerability due to the use of `strncpy` in the `print_text` function. Although it limits copying up to 64 bytes (0x3f in hexadecimal), it does not null-terminate `newbuf` if the input string is longer than 62 characters, leading to unpredictable behavior or a crash. To fix this, replace `strncpy` with `strlcpy`, which guarantees null-termination and specifies the buffer size.</code></pre>
|
||||
</details>
|
||||
<details class="bg-green">
|
||||
<summary>Q4 - Russian-English translation</summary>
|
||||
<summary>Q5 - Russian-English translation</summary>
|
||||
<pre><code class="nim">> Translate to english:
|
||||
```
|
||||
Заметил что через какое-то время перестает работать i2pd. Пока не перезапустишь сервис, либо не нажмешь в админке перезагрузку конфигов. Это известный баг? Или я что-то не так настроил?Обновился до последней версии. Ни чего не поменялось. У меня. mac os сборка. Из интересного даже локал хост с консолью не открывается, точнее он это делает раз через раз. Но когда открывается показывает что тунели есть. Ведет себя буд-то утечка памяти, или что то такое.
|
||||
|
@ -1058,8 +1204,35 @@ print(bio.getvalue())
|
|||
```
|
||||
Note: In the original code, `f.read` was called without any arguments, which would return a generator object. I changed it to simply `for byte in f`, which will iterate over each line of the file. Also, `bio.write(bytes([byte ^ 6]))` should be `bio.write(bytes([byte[0] ^ 6]))`, because `byte` is already a single character (not a list or bytes), so we need to access its first element using `[0]`. Finally, I replaced `f.close()` with the context manager syntax `with open... as f:`, which ensures that the file is always properly closed.</code></pre>
|
||||
</details>
|
||||
<details class="bg-red">
|
||||
<summary>Q4 - Indentifying C vulnerability</summary>
|
||||
<pre><code class="nim">> Do you see any vulnerability in this C code?
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void print_text(const char* inbuf) {
|
||||
char newbuf[64] = {0};
|
||||
strncpy(newbuf, inbuf, 0x3f);
|
||||
printf(newbuf);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
if (argc > 1) {
|
||||
print_text(argv[1]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Keep your answer short. Just a few sentences about what you identified.</code></pre>
|
||||
<pre><code class="nim">The code has two potential vulnerabilities:
|
||||
|
||||
1. **Undefined Behavior**: The `strncpy` function is used with a count of 63 (0x3f), which may not be the maximum length of the `newbuf` array, potentially leading to buffer overflow.
|
||||
2. **Lack of Input Validation**: The `print_text` function does not check if `inbuf` is null before copying it to `newbuf`, allowing a potential NULL pointer dereference attack.</code></pre>
|
||||
</details>
|
||||
<details class="bg-green">
|
||||
<summary>Q4 - Russian-English translation</summary>
|
||||
<summary>Q5 - Russian-English translation</summary>
|
||||
<pre><code class="nim">> Translate to english:
|
||||
```
|
||||
Заметил что через какое-то время перестает работать i2pd. Пока не перезапустишь сервис, либо не нажмешь в админке перезагрузку конфигов. Это известный баг? Или я что-то не так настроил?Обновился до последней версии. Ни чего не поменялось. У меня. mac os сборка. Из интересного даже локал хост с консолью не открывается, точнее он это делает раз через раз. Но когда открывается показывает что тунели есть. Ведет себя буд-то утечка памяти, или что то такое.
|
||||
|
@ -1095,7 +1268,8 @@ Only output the translation, nothing else.</code></pre>
|
|||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2">
|
||||
<h2><b>Closing Remarks</b></h2>
|
||||
<p>In this tutorial, you've set up a private LLM experience using ollama and Open WebUI. By exposing it via Tor, your conversations remain anonymous and private. None of your data will be sent anywhere or used for training new models. While the open model ecosystem is still somewhat behind the proprietary technologies and big datacenters, it quickly catches up.<br>
|
||||
<p>In this tutorial, you've set up a private LLM experience using ollama and Open WebUI. Your conversations remain anonymous and private, no data will be sent anywhere or used for training new models.<br>
|
||||
While the open model ecosystem is still somewhat behind the proprietary technologies and big datacenters, it quickly catches up.<br>
|
||||
It's safe to assume in a few years we will have models as capable as current Claude or OpenAI products, running with fraction of the cost on your own hardware. What a time to be alive!</p>
|
||||
</div>
|
||||
</div><!-- /row -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue