WP Manifestindependent plugin directory
manifest / integrations / alist-client-plugin-for-wordpress

AIYA-CMS 文件提取(Alist API) WP Registry grade D+. High-severity findings · 2 findingsWP RegistryHigh-severity findings · 2 findingsOpen the reportD+

适用于 WordPress 的 Alist 客户端插件,转发 Alist 服务器中的文件链接到网页中。

★ 10stars
51release downloads
≈10active sites
v1.1.0latest · 1 year ago

Install

Download alist-client-plugin-for-wordpress.zip From the v1.1.0 release on GitHub, Apr 13, 2025

Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/yeraph-plus/alist-client-plugin-for-wordpress/releases/download/v1.1.0/alist-client-plugin-for-wordpress.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Alist 文件列表客户端插件 for WordPress

风险提示: 此插件的上游项目 alist 被曝供应链投毒,请自行考量是否弃用。 Source from

截图

使用 WordPress 短代码功能在文章中插入 Alist 服务器中的文件链接,通过 Alist 托管站点的文件下载。

插件说明

需要 PHP>=8.1 并包含 curl 和 json 拓展

插件使用 Alist API 实现,所有请求均在后端完成,无需担心令牌泄露。

短代码功能完整支持 API 的 get、list、search 接口,可使用文件路径、文件夹、索引关键词方式获取 Alist 中的文件或文件列表,支持分页显示。

使用说明

各选项详细说明请见插件设置页,以下为一些需要注意的地方:

  1. 短代码支持使用交互表单快捷输入,但仅限经典编辑器,未适配古腾堡。

  2. 如果使用搜索接口,需要先为 Alist 配置数据库,否则 Alist 是不支持索引的。

  3. 前端使用 bootstrap-icons 图标库匹配文件图标,在站点中会额外加载图标库字体的样式表。

  4. 插件中设置的 Alist 服务器地址需要外部可访问,如果你的 Alist 无法从外部访问(如 http://127.0.0.1:5244/),请将插件链接设置改为 “提取直链”,否则插件会直接拼接为内部链接。

  5. 插件默认使用异步请求文件列表,异步加载时会在页面中载入额外的JS组件,可能会有部分 Pjax 形式的主题不兼容,此时可切换为同步加载,但是会拖慢页面加载速度。

  6. 插件默认在获取到超过10个文件时开始分页,可通过设置为0不分页,但由于 Alist 索引文件时强制要求分页参数,可在短代码中添加 per_page="10" 参数覆盖全局设置。

  7. 如果配置短代码参数 refresh="ture" ,会使 Alist 跳过自身缓存直接从网盘位置获取文件,通常不建议使用。

有使用问题/功能建议请提 issue ,随缘处理。

Alist API 的封装类说明

插件使用 Alist API 的所有请求方法封装在项目的 /lib 目录下,是根据 Alist API (V3) 实现的PHP版客户端实例。

封装部分仅Alist的auth、fs、public这三组接口,其他的元信息、用户、设置等的功能接口外部也用不上,就没管。

目录下提供了 demo.php 方法样例,你可以以此为参考自行实现其他功能或将 Alist 嵌入到其他PHP项目中。

此实例的请求参数和返回响应与官方文档一致,具体的参数定义请参照 Alist 文档 。

完整短代码参数说明

最简调用:

[alist_cli path="/" /]

不指定方法时,默认使用get方法。

PS:插件会通过判断传入的路径是否为文件切换到list方法,只是简单正则检查,不一定准。

文件列表:

[alist_cli method="list" path="/" password="" per_page="0" refresh="false" /]

参数按顺序为插件方法、路径、访问密码、分页、强制刷新,前台使用文件列表模板。

文件/文件夹详情:

[alist_cli method="get" path="/readme.md" password="" per_page="0" refresh="false" /]

参数按顺序为插件方法、文件&文件夹路径、访问密码、分页、强制刷新,前台使用文件详情卡片模板。

搜索文件或文件夹:

[alist_cli method="search" parent="/" keywords="关键词" scope="2" password="" per_page="0" /]

参数按顺序为插件方法、搜索根路径、关键词、搜索范围、访问密码、分页,前台使用文件列表模板。

使用搜索方法时列表加载更慢,这是因为 Alist 索引结果是不包含文件详细参数的,所以内部需要将列表重新循环为get方法以获取文件。

直接输出文件真实地址:

[alist_raw_url path="/readme.md" /]

用于嵌入网页播放器。但是播放器插件是不打算写了。

加载速度优化参考

因为通常的 Alist 站点都会使用cf加速,并且插件是通过 Curl 发送外部请求的,所以直接在服务器配置DNS解析到 Alist 服务器,可以加速加载速度,或者在 Nginx 配置条件反向代理到 Alist 也行。

在线要饭

赏赏作者,支持一下:我的爱发电

Releases

3 releases. Each count is every asset in that release; expand a row for the breakdown.

Tag
Published
Assets
Downloads
v1.1.0 latest
Apr 13, 2025 1 year ago
alist-client-plugin-for-wordpress.zip
25
Dec 26, 2024 1 year ago
alist-client-plugin-for-wordpress.zip
8
Sep 28, 2024 2 years ago
alist-client-plugin-for-wordpress.zip
18

Active-site estimate ≈10 comes from the median of recent superseded releases. Method.

D+ grade

Security

AIYA-CMS 文件提取(Alist API) 1.1.0 · audited by WP Registry

High-severity findings.

1 high 1 medium
Audited release
1.1.0
Findings
2
Worst severity
high
Content hash
2ec9f53e5ef2d46544c00c5c…

Findings

  • high Unauthenticated Alist file listing and download via alist_request_data AJAX

    missing_auth

    wp_ajax_nopriv_alist_request_data and wp_ajax_alist_request_data both call aya_alist_callback_ajax_post. The handler verifies only nonce action alist_cli_data_nonce — no capability check, no path allow-list, no signed shortcode payload. Default alist_client_ajax_load is true, so every public [alist_cli] render prints wp_create_nonce() plus the query JSON in an inline fetch(); unauthenticated users share that uid-0 nonce. An attacker then POSTs data_atts as JSON with query_method_is list|get|search and an arbitrary path/parent/keywords/password/per_page. aya_alist_template_workflow_main() rejects other methods (mkdir/remove/etc. are not reachable) but forwards the whole decoded object to Alist_API::fs_request() using the site-stored Alist username/password JWT (aya_alist_transient_token). Templates then output listings and aya_alist_format_file_link() builds working download URLs (https://{alist}/d{path}?sign=... by default, or raw cloud URLs when view_link_type is raw_url). Consequence: any visitor who can load a page that uses the shortcode (the intended deployment) can enumerate and download every object the configured Alist account can read, not merely the folder the editor chose. Same endpoint also accepts per_page=0 which makes aya_alist_format_page_item() loop while $i <= ceil($total/0) (INF), or a huge per_page with method=search which issues one fs_get per hit.

    inc/client-templates.php:302-409

    Recommendation

    Do not trust client JSON as the Alist query. Sign (HMAC) the shortcode attributes server-side and reject unsigned or mutated path/method/parent. Alternatively look up the allowed query by a server-issued token rather than echoing the full request. Keep nopriv only if listings are meant to be public, and still constrain paths. Cap per_page, reject non-positive page sizes, and do not pass extra keys through to fs_request().

  • medium Reflected XSS via unescaped Alist AJAX HTML consumed by innerHTML

    xss_reflected

    inc/ has no esc_html/esc_attr/esc_url. aya_alist_template_search_result() concatenates $fs_query['keywords'] into an h6; aya_alist_template_file_tables() concatenates $fs_query['path']; file_detail echoes $fs_data['provider'] and file names; readme is printed as HTML when alist_client_display_readme is on; aya_alist_template_error() appends the raw Alist error string; download hrefs are unquoted-safe only by accident. The default async loader assigns that markup with container.innerHTML = content (event handlers execute). Because data_atts is attacker-controlled on the nopriv AJAX action (see missing_auth finding), a logged-out visitor who is CSRF'd with the public uid-0 nonce receives text/html from admin-ajax.php containing those fields. The reliable reflected vector is method=search after Alist search returns an array (even empty content): keywords are echoed before the loop. Contributor/Author shortcode attributes are a weaker stored path because wp_kses_post strips event handlers from angle-bracket tags on save; the AJAX POST bypasses kses entirely.

    inc/client-templates.php:331-350,450-451,493,514,567

    Recommendation

    Escape path, keywords, file names, provider, and error strings with esc_html(); pass hrefs through esc_url(); run readme through wp_kses_post() if HTML is intentional. Prefer DOM text assignment over innerHTML for the AJAX loader. Return JSON from the AJAX action instead of HTML fragments so admin-ajax.php is not a reflected HTML document.

WP Registry hashes the installable build and reports on that exact bytes-for-bytes copy. Embargoed findings are withheld until they are disclosed, so a clean verdict means nothing public is outstanding. WP Manifest does not audit code itself.