A minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES.
Find a file
rugk 2c4dd2594c fix: do not encode source JSON translation string resulting in wrong display of special characters like '
Fixes #1712

Disclosure: Coded with help of Copiot. (description wrtten by me)

So this does indeed loosen the encoding a bit. However, IMHO, it was neither better before though. You could always bypass the encoding for `args{0]` when  you just include `<a` (or the other tag) somewhere or so.

**One important notice:** This was (due to the exceptions before and afterwards) valid before and also now: Translators **could** (and can) if they have malicious intent, inject/do "XSS attacks".
Thus, translations PRs (also from Crowdin) should be reviewed for wild HTML code inside translations. I suppose this is easy to fix, but anyway a valid risk.

But IMHO, we should teat the JSON files being part of our source code as a "trusted source". In the end, such an attak is basicaly just ends up being injecting malicious code. I hope such contributors would be detected.

References I explicitly checked again to not introduce an XSS here: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html and the PHP doc for he HTML encoding.

I feel the safter way obviously would be encoding the _whole_ string _after_ translation (just like you should apply DOMPurify after everything), but as explained it was not done before and would break compatibility. Also, I looked through the sources and I see no risk described by doing it only for the "dangerous" "untrusted" inputs.
Only here is a notice that `%s` shall not be used in some contexts, for example to define a tag: https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#dangerous-contexts (obviously in such a case, attacks may be possible even with encoding; but again; this is nothing new)

The basic "problem" of it all is: We want HTML to be translated/be usable in our translation. If we'd get rid of that, we would get for sure rid of all such XSS attack possibilities. But that woud be a bigger refactoring, so IMHO, this here is fine for a fix for the issue at hand.

Ah another point: I think the `is_int` check is harmless, but it's also kinda useless. Maybe it is some kind of obscure performance optimisation. (Yeah ints have nothing to encode as they have nothing that could be used for XSS, but they could also just be passed through that function.)
2025-11-13 10:52:08 +00:00
.devcontainer Add PHP composer global installation for DevContainer 2025-11-11 20:02:36 +01:00
.github Apply suggestions from code review 2025-11-12 19:36:05 +01:00
.vscode add workspace settings with config files treated as INI 2023-12-08 16:30:45 +00:00
bin avoid undefined variable warning 2025-07-29 07:49:56 +02:00
cfg Fix typo in Shlink config docs 2025-11-09 10:00:48 +11:00
css update bootstrap CSS library from 5.3.7 to 5.3.8 2025-10-09 09:24:08 +02:00
doc incrementing version 2025-11-12 08:00:50 +01:00
i18n New Crowdin updates (#1706) 2025-11-08 06:00:28 +01:00
img apply suggestions to use existing bootstrap icons 2025-10-05 09:47:39 +02:00
js incrementing version 2025-11-12 08:00:50 +01:00
lib fix: do not encode source JSON translation string resulting in wrong display of special characters like ' 2025-11-13 10:52:08 +00:00
tpl update DOMpurify library from 3.2.7 to 3.3.0 2025-10-25 10:52:40 +02:00
tst fix: do not encode source JSON translation string resulting in wrong display of special characters like ' 2025-11-13 10:52:08 +00:00
vendor update ip-lib library from 1.20.0 to 1.21.0 2025-10-09 09:32:17 +02:00
.codeclimate.yml removing PHPCS from CodeClimate, since it can't be configured and contradicts our code style enforced by other checkers 2018-01-06 15:10:21 +01:00
.csslintrc add codeclimate settings 2016-07-06 13:20:14 +02:00
.editorconfig Force JSON request for getting paste data 2017-04-11 16:34:13 +02:00
.gitattributes Merge branch 'master' into eslint 2025-10-08 18:31:10 +02:00
.gitignore chore: always ignore composer PHP bin dir 2025-09-03 12:38:13 +00:00
.htaccess.disabled add config for older apache releases without included mime type 2025-02-13 09:03:13 +01:00
.jshintrc addressing issues found by codacy 2018-10-20 22:05:35 +02:00
.nsprc add Node Security configuration and enabling it in CodeClimate 2018-01-06 08:06:09 +01:00
.php_cs Add missing fixers from PHP CS 2016-10-31 11:29:25 +01:00
.scrutinizer.yml enable xdebug for coverage in scrutinizer 2025-07-19 21:36:31 +02:00
.styleci.yml limit files of StyleCI scan 2022-01-10 21:26:28 +01:00
BADGES.md remove broken & obsolete badges 2025-10-08 09:30:23 +02:00
browserconfig.xml moved images to img folder 2017-01-08 10:13:12 +01:00
CHANGELOG.md chore: prepare for next release 2025-11-12 08:51:05 +01:00
CODE_OF_CONDUCT.md document the applicability of RFC 1855 / Netiquette 2019-07-27 07:31:34 +02:00
composer.json update ip-lib library from 1.20.0 to 1.21.0 2025-10-09 09:32:17 +02:00
composer.lock update ip-lib library from 1.20.0 to 1.21.0 2025-10-09 09:32:17 +02:00
CREDITS.md incrementing version 2025-10-12 08:50:13 +02:00
crowdin.yml Update Crowdin configuration file 2020-10-04 12:41:27 +02:00
index.php enable strict types in PHP 2024-06-04 07:13:55 +02:00
LICENSE.md Update LICENSE.md 2024-08-30 15:14:28 +00:00
Makefile chore: prepare for next release 2025-11-12 08:51:05 +01:00
manifest.json moved images to img folder 2017-01-08 10:13:12 +01:00
Procfile Create Procfile 2022-02-10 18:53:39 -05:00
README.md incrementing version 2025-11-12 08:00:50 +01:00
robots.txt adding an example to opt-out of the privatebin directory 2020-04-08 05:35:38 +02:00
SECURITY.md incrementing version 2025-11-12 08:00:50 +01:00

PrivateBin

Current version: 2.0.3

PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of stored data.

Data is encrypted and decrypted in the browser using 256bit AES in Galois Counter mode.

This is a fork of ZeroBin, originally developed by Sébastien Sauvage. PrivateBin was refactored to allow easier and cleaner extensions and has many additional features.

What PrivateBin provides

  • As a server administrator you don't have to worry if your users post content that is considered illegal in your country. You have plausible deniability of any of the pastes content. If requested or enforced, you can delete any paste from your system.

  • Pastebin-like system to store text documents, code samples, etc.

  • Encryption of data sent to server.

  • Possibility to set a password which is required to read the paste. It further protects a paste and prevents people stumbling upon your paste's link from being able to read it without the password.

What it doesn't provide

  • As a user you have to trust the server administrator not to inject any malicious code. For security, a PrivateBin installation has to be used over HTTPS! Otherwise you would also have to trust your internet provider, and any jurisdiction the traffic passes through. Additionally the instance should be secured by HSTS. It can use traditional certificate authorities and/or use a DNSSEC protected DANE record.

  • The "key" used to encrypt the paste is part of the URL. If you publicly post the URL of a paste that is not password-protected, anyone can read it. Use a password if you want your paste to remain private. In that case, make sure to use a strong password and share it privately and end-to-end-encrypted.

  • A server admin can be forced to hand over access logs to the authorities. PrivateBin encrypts your text and the discussion contents, but who accessed a paste (first) might still be disclosed via access logs.

  • In case of a server breach your data is secure as it is only stored encrypted on the server. However, the server could be abused or the server admin could be legally forced into sending malicious code to their users, which logs the decryption key and sends it to a server when a user accesses a paste. Therefore, do not access any PrivateBin instance if you think it has been compromised. As long as no user accesses this instance with a previously generated URL, the content can't be decrypted.

Options

Some features are optional and can be enabled or disabled in the configuration file:

  • Password protection

  • Discussions, anonymous or with nicknames and IP based identicons or vizhashes

  • Expiration times, including a "forever" and "burn after reading" option

  • Markdown format support for HTML formatted pastes, including preview function

  • Syntax highlighting for source code using prettify.js, including 4 prettify themes

  • File upload support, image, media and PDF preview (disabled by default, size limit adjustable)

  • Templates: By default there are bootstrap5, bootstrap CSS and darkstrap to choose from and it is easy to adapt these to your own websites layout or create your own.

  • Translation system and automatic browser language detection (if enabled in browser)

  • Language selection (disabled by default, as it uses a session cookie)

  • QR code for paste URLs, to easily transfer them over to mobile devices

Further resources

Run into any issues? Have ideas for further developments? Please report them!