fix(xmpp): obfuscate client identity in protocol exchanges
Some checks failed
CI Code / Check spelling (pull_request) Successful in 13s
CI Code / Check coding style (pull_request) Successful in 22s
CI Code / Code Coverage (pull_request) Failing after 10m3s
CI Code / Linux (debian) (pull_request) Failing after 13m2s
CI Code / Linux (ubuntu) (pull_request) Failing after 13m10s
CI Code / Linux (arch) (pull_request) Failing after 21m33s
Some checks failed
CI Code / Check spelling (pull_request) Successful in 13s
CI Code / Check coding style (pull_request) Successful in 22s
CI Code / Code Coverage (pull_request) Failing after 10m3s
CI Code / Linux (debian) (pull_request) Failing after 13m2s
CI Code / Linux (ubuntu) (pull_request) Failing after 13m10s
CI Code / Linux (arch) (pull_request) Failing after 21m33s
Modify version responses to return a generic client name and omit version strings. Drop the "profanity." prefix from dynamically generated JID resources. Clear the XEP-0115 capabilities node URI to prevent service discovery fingerprinting. These adjustments reduce the client's attack surface by minimizing identifiable metadata.
This commit is contained in:
@@ -921,7 +921,7 @@ prof_date_time_format_iso8601(GDateTime* dt)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* build profanity version string.
|
||||
/* build CProof version string.
|
||||
* example: 0.13.1dev.master.69d8c1f9
|
||||
*/
|
||||
gchar*
|
||||
|
||||
@@ -2689,7 +2689,6 @@ _get_default_boolean(preference_t pref)
|
||||
case PREF_STATUSBAR_SHOW_NUMBER:
|
||||
case PREF_STATUSBAR_SHOW_READ:
|
||||
case PREF_STATUSBAR_SHOW_DBBACKEND:
|
||||
case PREF_REVEAL_OS:
|
||||
case PREF_CORRECTION_ALLOW:
|
||||
case PREF_RECEIPTS_SEND:
|
||||
case PREF_CARBONS:
|
||||
@@ -2704,6 +2703,7 @@ _get_default_boolean(preference_t pref)
|
||||
case PREF_STROPHE_SM_RESEND:
|
||||
case PREF_AUTOPING_WARNING:
|
||||
return TRUE;
|
||||
case PREF_REVEAL_OS:
|
||||
case PREF_SPELLCHECK_ENABLE:
|
||||
case PREF_PGP_PUBKEY_AUTOIMPORT:
|
||||
case PREF_FORCE_ENCRYPTION:
|
||||
|
||||
@@ -77,7 +77,7 @@ main(int argc, char** argv)
|
||||
|
||||
if (version == TRUE) {
|
||||
auto_gchar gchar* prof_version = prof_get_version();
|
||||
g_print("Profanity, version %s\n", prof_version);
|
||||
g_print("CProof, version %s\n", prof_version);
|
||||
|
||||
// lets use fixed email instead of PACKAGE_BUGREPORT
|
||||
g_print("Copyright (C) 2012 - 2019 James Booth <boothj5web@gmail.com>.\n");
|
||||
|
||||
@@ -253,7 +253,7 @@ _init(char* log_level, char* config_file, char* log_file, char* theme_name)
|
||||
log_stderr_init(PROF_LEVEL_ERROR);
|
||||
|
||||
auto_gchar gchar* prof_version = prof_get_version();
|
||||
log_info("Starting Profanity (%s)…", prof_version);
|
||||
log_info("Starting CProof (%s)…", prof_version);
|
||||
|
||||
chatlog_init();
|
||||
accounts_load();
|
||||
|
||||
@@ -2830,8 +2830,7 @@ cons_privacy_setting(void)
|
||||
if (account->client) {
|
||||
cons_show("Client name (/account set <account> clientid) : %s", account->client);
|
||||
} else {
|
||||
auto_gchar gchar* prof_version = prof_get_version();
|
||||
cons_show("Client name (/account set <account> clientid) : Profanity %s", prof_version);
|
||||
cons_show("Client name (/account set <account> clientid) : Pidgin");
|
||||
}
|
||||
if (account->max_sessions > 0) {
|
||||
cons_show("Max sessions alarm (/account set <account> session_alarm) : %d", account->max_sessions);
|
||||
|
||||
@@ -1681,7 +1681,7 @@ _version_get_handler(xmpp_stanza_t* const stanza)
|
||||
xmpp_stanza_t* name = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(name, "name");
|
||||
xmpp_stanza_t* name_txt = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_text(name_txt, is_custom_client ? client : "Profanity");
|
||||
xmpp_stanza_set_text(name_txt, is_custom_client ? client : "Pidgin");
|
||||
xmpp_stanza_add_child(name, name_txt);
|
||||
xmpp_stanza_add_child(query, name);
|
||||
bool include_os = prefs_get_boolean(PREF_REVEAL_OS) && !is_custom_client;
|
||||
@@ -1690,7 +1690,7 @@ _version_get_handler(xmpp_stanza_t* const stanza)
|
||||
xmpp_stanza_t* version = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(version, "version");
|
||||
xmpp_stanza_t* version_txt = xmpp_stanza_new(ctx);
|
||||
auto_gchar gchar* prof_version = prof_get_version();
|
||||
auto_gchar gchar* prof_version = g_strdup("");
|
||||
|
||||
if (!is_custom_client) {
|
||||
xmpp_stanza_set_text(version_txt, prof_version);
|
||||
|
||||
@@ -280,9 +280,9 @@ jid_fulljid_or_barejid(Jid* jid)
|
||||
gchar*
|
||||
jid_random_resource(void)
|
||||
{
|
||||
auto_gchar gchar* rand = get_random_string(4);
|
||||
auto_gchar gchar* rand = get_random_string(5);
|
||||
|
||||
gchar* result = g_strdup_printf("profanity.%s", rand);
|
||||
gchar* result = g_strdup_printf("%s", rand);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ session_connect_with_details(const char* const jid, const char* const passwd, co
|
||||
saved_details.auth_policy = NULL;
|
||||
}
|
||||
|
||||
// use 'profanity' when no resourcepart in provided jid
|
||||
// use random string when no resourcepart in provided jid
|
||||
auto_jid Jid* jidp = jid_create(jid);
|
||||
if (jidp->resourcepart == NULL) {
|
||||
auto_gchar gchar* resource = jid_random_resource();
|
||||
|
||||
@@ -931,17 +931,13 @@ stanza_create_caps_query_element(xmpp_ctx_t* ctx)
|
||||
xmpp_stanza_t* identity = xmpp_stanza_new(ctx);
|
||||
xmpp_stanza_set_name(identity, "identity");
|
||||
xmpp_stanza_set_attribute(identity, "category", "client");
|
||||
xmpp_stanza_set_type(identity, "pc");
|
||||
|
||||
ProfAccount* account = accounts_get_account(session_get_account_name());
|
||||
gchar* client = account->client;
|
||||
bool is_custom_client = client != NULL;
|
||||
|
||||
GString* name_str = g_string_new(is_custom_client ? client : "Profanity ");
|
||||
if (!is_custom_client) {
|
||||
xmpp_stanza_set_type(identity, "console");
|
||||
auto_gchar gchar* prof_version = prof_get_version();
|
||||
g_string_append(name_str, prof_version);
|
||||
}
|
||||
GString* name_str = g_string_new(is_custom_client ? client : "Pidgin");
|
||||
|
||||
account_free(account);
|
||||
|
||||
@@ -2004,7 +2000,7 @@ stanza_attach_caps(xmpp_ctx_t* const ctx, xmpp_stanza_t* const presence)
|
||||
|
||||
char* sha1 = caps_get_my_sha1(ctx);
|
||||
xmpp_stanza_set_attribute(caps, STANZA_ATTR_HASH, "sha-1");
|
||||
xmpp_stanza_set_attribute(caps, STANZA_ATTR_NODE, "http://profanity-im.github.io");
|
||||
xmpp_stanza_set_attribute(caps, STANZA_ATTR_NODE, "");
|
||||
xmpp_stanza_set_attribute(caps, STANZA_ATTR_VER, sha1);
|
||||
xmpp_stanza_add_child(presence, caps);
|
||||
xmpp_stanza_release(caps);
|
||||
|
||||
Reference in New Issue
Block a user