bukuserver: reordering the bookmarks of an open instance, with no CSRF token
Two POST routes in bukuserver write to the bookmark database without checking a CSRF token, and the page renders a token that is never validated. The report was closed without a fix on 3 November 2026; master as of 27 November has changed nothing.

Illustration · SecuFocus
At a glance
Key points
bukuserver is the web interface of buku, the command-line bookmark manager. Two of its routes, POST /bookmark/reorder and POST /bookmark/swap, write to the database straight from request.form without ever going through Flask-WTF's CSRF check, and CSRFProtect is never instantiated anywhere in the package. A page on another origin can therefore, from the victim's browser, post a plain HTML form and have the database reordered. On 3 November 2026 the maintainer closed the report without a fix, pointing to a pull request nobody has opened; master as of 27 November still has neither CSRFProtect nor validate() on those two handlers. This article sets out what the forged request actually changes, under which conditions a self-hosted instance is affected, and why the only solid defence remains authentication in front of the tool.
Two routes that write to the database, unchecked
bukuserver is the web interface of buku, the command-line bookmark manager. It is built on Flask and Flask-Admin. Two of its routes do nothing but move bookmarks around: POST /bookmark/reorder stores a whole sort order in the database, and POST /bookmark/swap exchanges two positions.
The reorder handler goes through no form at all. It reads request.form['filters'] directly, derives a sort order from it and calls bukudb.reorder(order). The swap handler builds forms.SwapForm(), a form with two hidden fields, id1 and id2, then calls bukudb.swap_recs(). Neither of them calls validate() or validate_on_submit(), which is precisely where Flask-WTF performs its token check.
Checked against master as of 27 November 2026 (commit 9ec3730): flask_wtf.CSRFProtect is instantiated nowhere under bukuserver/. Yet Flask-WTF is still a declared dependency (Flask-WTF>=1.0.1), and a session key is configured, since app.config['SECRET_KEY'] falls back to BUKUSERVER_SECRET_KEY or os.urandom(24). The bookmarks_list.html template does provide for a csrf_token field inside the swap form, but only if that variable exists in the template context; and even when present, the field is matched against nothing on the server side, since no CSRFProtect is registered on the application.
What the forged request really changes
Both routes accept an application/x-www-form-urlencoded POST: exactly the shape a page on another origin can send with a plain HTML form, with no preflight request. There is no custom header to negotiate and no JSON to produce.
In practice, a hostile page can, from the victim's browser, impose a sort order on the entire bookmark database or exchange two chosen positions. It is not a data read, and it is not a takeover: it is a write. The bookmark is still there, but the order its owner had built, often by hand, no longer means anything. On an instance used as a research memory, that disorder costs more than it looks.
The reporter extends the same finding to the fetch and refresh routes: a forged form can also trigger, from the victim's browser, outbound requests and a bulk refresh. The common thread is always the same: a write triggered by a third-party page, with nothing to tell the legitimate request from the forged one.
A guard was indeed added to the swap handler, in commit 0619a49: the return redirect is validated, and an absolute or protocol-relative URL is replaced by the index view. That is protection against open redirect, not against CSRF, and it says nothing about the write that has already happened.
Who is affected, and under which conditions
bukuserver delegates authentication to the host. The README describes adding basic auth in front of the application, through a data/basic_auth/.htpasswd file; in the docker-compose/data/nginx/nginx.conf file shipped with the repository, both auth_basic lines are commented out by default. An instance deployed as-is is therefore an administrative interface open on the network.
Two situations, two lines of reasoning. If the instance is reachable without authentication, CSRF adds little: anyone can already write to the database, and the problem is exposure, not the token. If the operator has put basic auth in front of the tool, the forged request still succeeds as long as the victim's browser has the credential cached: the browser sends it by itself, and the third-party form goes through with the victim's rights.
It is that second case that makes the report interesting. The protection exists, it is correctly placed in front of the application, and it is not enough. Any page visited by a legitimate user becomes a write path to their own bukuserver.
Why the report stopped there
Issue #912 was opened on 2 November 2026 by the carfeii account and closed on 3 November 2026 by the maintainer, jarun, after two comments. No pull request is linked to it, and a search across the repository shows none picking the subject up.
On 2 November, LeXofLeviafan argued that the application delegates its security to the server hosting it, that its API already allows most database modifications with no authentication at all, reordering included, and that a dedicated endpoint even allows wiping the database entirely. Checked in the code: POST /api/bookmarks/reorder does exist, and DELETE /api/bookmarks calls cleardb(confirm=False). The argument is therefore factually correct.
jarun replied on 3 November: “please raise the PR if you must and then we can have a look”. The ball went back to the reporter, the issue was closed, and nothing followed. It is not a reasoned rejection of the problem; it is a transfer of the burden of proof and of the fix onto the person who reported it.
State of the code as of 27 November 2026: neither CSRFProtect nor validate() has been added to the two handlers, and the CHANGELOG of the unreleased version mentions only a mitigation for Host header poisoning via BUKUSERVER_SERVER_NAME. The last published tag, 5.1.1, carries no more protection. As things stand, no version of bukuserver is fixed on this point.
No CVE covers this report
Two NVD entries concern buku, and neither matches issue #912, which itself cites no CVE. CVE-2026-121627, published on 3 November 2026, covers a stored XSS: an unescaped bookmark URL in the list, feedable through the /api/bookmarks endpoint (issue #911). CVE-2026-123201, published on 5 November 2026, covers an unauthenticated SSRF via /api/fetch_data and /api/network_handle (issue #910).
Both entries sit at status “Deferred”: the NVD recorded the description without carrying out the analysis. The second is fixed on master by commit 13f6497 of 5 November 2026.
The practical consequence: watching security advisories will not be enough to catch this one. With no CVE identifier and no CHANGELOG entry, the only trace left is the issue, closed.
What actually protects, in order
Three measures, from the most effective to the most incidental.
Do not expose the tool. bukuserver is not a public service: it is an administrative interface for your own bookmark database. Behind a VPN, on an internal network, or listening on 127.0.0.1 behind a reverse proxy that alone faces the outside, it stops being a target.
Keep authentication in front of it, remembering that it does not settle the CSRF question: it reduces the surface, it does not remove the case of the browser replaying a cached credential. A dedicated credential, not reused elsewhere, and a short session limit the reach.
Treat the bukuserver API as an administrative interface in its own right. It allows reordering, deletion and a full wipe, and it asks for nothing by itself: the maintainer says so himself in the issue. If you do not use it, block it at the proxy. A hostile page that can no longer reach those routes no longer needs a token to be stopped.
That leaves those who want the fix in the code: it is short, CSRFProtect(app) plus a validate() on the two handlers, and the form already renders the csrf_token field. The route the maintainer announced is a pull request. None exists to date.
Check and explore
Sources for this article
Numbers connect each reference to the passages that use it. Dates show when the documentation was consulted.
This article draws on the sources above. The exercises are for you to try on your devices; SecuFocus does not present them as tests carried out by its editorial team. Interfaces and features can change. Method and corrections.
Cite this article
Keep this reference with the article when you save or share it.