Skip to main content

fints 0.2.0 copy "fints: ^0.2.0" to clipboard
fints: ^0.2.0 copied to clipboard

FinTS 3.0 and 4.1 client for German banks. Retrieves accounts, balances and transactions with PIN/TAN, two-step TAN, decoupled approval and PSD2 strong customer authentication.

0.2.0 #

Fixes from a security review. An app may notice three changes: after two logins in a row whose answer the client could not read, it refuses to log in itself until a new client is created; more malformed bank data raises FinTsProtocolException instead of being read as something else; and a call running when close() is called fails with StateError, also where its last answer was already on its way.

  • A synchronization the bank refuses for the one-step method is repeated with a two-step method after a 3920 only where the bank names no other error than 9050 or 9800. Banks never list the one-step method in 3920, so a 3920 next to another error, such as 9941 "Signatur ungültig", sent a wrong PIN twice
  • close() stops a running call at its next message: after the request on its way, the call sends nothing but the end of its dialogs, and fails with StateError also where that request was its last, unless that request failed. A call still setting up the session went on with the synchronization, the lookup of the TAN media and the login, all signed with the PIN, and the login could send the user a TAN or an app approval nobody would answer
  • Bank data that would take hours, gigabytes or the whole stack to read is malformed (FinTsProtocolException, or FormatException from Mt940, Camt and Amount.parseDecimal): a FinTS 3.0 message of more than 1,000,000 data elements and segments or with more than one encrypted part, an XML document of more than 500,000 nodes besides text or one per 16 characters, whichever is more, or one nested more than 100 deep, an MT940 field of more than 65,536 characters and an amount written with more than 64 characters. Such data from a broken or hostile server blocked the app for minutes to hours, took 1 to 4 GB of memory, or failed with StackOverflowError, which an app that catches FinTsException does not handle
  • The 128 MiB a query may hold count each data element or XML node of its pages as 512 bytes, more than any of them takes once parsed. They counted the bytes received, so that many pages of short elements took gigabytes
  • Bare & in XML, line breaks inside an MT940 field, repeated MT940 subfields, a long FinTS 4.1 namespace, a camt entry with many transaction details, long lists of TAN methods and the matching of tens of thousands of accounts with the SEPA account list take linear time: 400,000 & took 40 seconds, 40,000 line breaks 13 seconds, and the accounts 105 seconds on every getAccounts. Elements nested in others of their name, such as a camt entry in an entry, are read once instead of once for each one around them, and Mt940.parseTransactions no longer keeps every statement, which took 4 GB for 128 MiB of empty ones
  • Account numbers, HHD_UC data, FinTS 4.1 parameter names and the namespaces of FinTs4Client.queryVersions are read without patterns that exhaust the stack on several megabytes, and a structured TAN challenge of more than 65,536 characters stays unformatted in TanChallenge.plainMessage
  • HttpTransport copies each part of a response as it arrives, and refuses a response that announces more than maxResponseBytes without reading it. It kept the parts dart:io hands out as views into its read buffers, so a server that sent 15 MiB in one-byte parts took about 1 GB of memory, despite the limit meant to prevent that
  • The maximum message size and the timeouts of FinTS 3.0 bank parameter data count as not stated above 9999, the four digits HIBPA allows, and a message is compared with the maximum size in whole kilobytes. Larger values overflowed: from 2^53 KB on every message was refused, also with the saved state, so the client could never reach the bank again, and a timeout above about 9.2 trillion seconds made every call log in anew and ask for another TAN
  • An MT940 booking date, which states only month and day, gets the year that places it within its statement, between the dates of the opening and the closing balance; where one of them is missing, as in an MT942 with its creation date :13D:, the period reaches the value date on that side. It got the year of the value date, moved only between December and January, so that a refund or correction booked in January 2026 with the value date of a debit from months before showed as booked in January 2025. A statement whose closing balance is dated before its opening balance, or whose creation date cannot be read, is malformed
  • An amount whose sign the bank sends in a credit/debit mark (a camt entry or detail, a FinTS 3.0 or 4.1 balance, the balance of the account extension) is malformed if it is negative; the account extension is ignored as a whole then. The mark negated such a value once more, so that -50.00 with a debit mark read as a credit of 50.00
  • A camt batch booking is split into its transaction details only where they add up to it in its currency, and stays one booking otherwise, as where a detail lacks its amount: charges booked with the batch, or a detail in another currency, were lost from the transactions or changed their currency
  • A camt booking or value date given as date and time with Z or a UTC offset is the day in Germany at that moment, and a FinTS 4.1 time with one, such as the end of a TAN challenge or the time of a balance, is the moment it names. Both were read as German time, so that a booking at 23:30 UTC counted on the day before and a time in UTC was one or two hours off. 24:00:00 is midnight of the next day. A camt date the client cannot read, such as one with the offset +0100, is malformed instead of being read as German time, and a value date is never silently the booking date; a FinTS 4.1 time in such a form counts as missing
  • A FinTS 3.0 message that does not end with the message end (HNHBS), or whose encrypted part is no binary data, is malformed. A response cut off in transit, which dart:io hands over as complete where the bank states no length and the TLS connection ends without close_notify, was read as a whole one: the segments after the cut, the return codes of a cut encrypted part, or whole accounts and pages of transactions went missing without an error
  • TransactionFormat.auto takes camt.052 where the bank offers it and MT940 cannot be requested for the account. Where incomplete user parameter data listed HKKAZ but not HKCAZ, it chose MT940 and failed with FinTsUnsupportedException if the bank offered no HKKAZ version the client implements
  • A challenge in the dialog that looks up the TAN media gives TanChallenge.tanMediumName as null where the bank names no medium. It gave the placeholder noref the client sends there, as FinTS 4.1 did whenever the bank asked for strong authentication in that dialog
  • A login whose answer is lost, times out or cannot be read, such as an HTTP error, a web page in place of the answer or an encrypted FinTS 4.1 answer, counts until a login the bank takes: after two such logins in a row the client refuses the login itself, and every later call that would send the PIN fails with a FinTsBankException without return codes. The bank may have counted such a login as a failed attempt, and an app that retried sent the PIN again on every call. The client cannot tell a login that never reached the bank from a lost answer, so a connection that fails twice in a row has the same effect
  • The bank's limits on the PIN's length apply to logins only, not to the later messages of a dialog the bank has opened with that PIN, and where the bank parameter data rule out a login, by the PIN's length or the message's size, the client fetches them anew in an anonymous dialog before it fails (a bank that does not answer anonymously cannot refresh them). Saved limits never changed, since new ones come only in answer to a login: after the bank had raised its limit for a longer PIN, every call failed with ArgumentError without contacting the bank until the app dropped its saved state. A synchronization that brought the first parameter data, which ruled out the PIN, failed its own dialog end, and the dialog stayed open at the bank
  • The answers of a FinTS 4.1 bank reach logger with the content of every element called PIN or TAN replaced by ***, found by the structure of the XML rather than a pattern, as is such markup quoted in text, and an answer that is not XML the client can read as a placeholder. The pattern missed a PIN the bank echoed as <PIN xmlns="…">, in CDATA or with a prefix such as fints-msg:, and every TAN it echoed, which reached the log in clear text
  • A camt document or FinTS 4.1 message declared as Windows-1252 is decoded in about four times its size in memory. It went through a list of every byte: a 16 MiB document raised the app's peak memory by 480 MiB
  • On native platforms, the default HttpTransport sends plain http, which allowInsecureUrl allows to loopback addresses only, to the address directly, past any proxy. It followed HTTP_PROXY, so that where the environment named a proxy without exempting localhost, as on many company machines, a login to http://localhost went to the proxy with the PIN unencrypted. Plain http also bypasses a client set with runWithClient, which may follow the proxy as well. https still follows HTTPS_PROXY and NO_PROXY, and a client passed to HttpTransport is used as it is

0.1.2 #

  • Link the homepage coderoftime.dev and the repository's new location in the pub.dev listing
  • Require Dart 3.11, the lowest SDK that package:xml 7 supports (0.1.0 and 0.1.1 claimed 3.8 but could not be resolved below 3.11)

0.1.1 #

  • Make repository and issue tracker appear in pub.dev listing
  • No code changes included

0.1.0 #

First release.

  • FinTS 3.0 and 4.1 PIN/TAN clients (FinTs3Client, FinTs4Client): accounts, balances and transactions (camt.052 and MT940/MT942), with paging and SEPA account details.
  • One-step and two-step TAN, PSD2 strong customer authentication and decoupled approval (pushTAN, SecureGo plus); TAN method and medium selection, chipTAN flicker codes and photoTAN images. The TAN callback answers with a TanAnswer.
  • Bank parameter data, customer system ID and the chosen TAN method are kept in an exportable state string, which holds neither PIN nor TAN.
  • A client never sends its PIN again once the bank has refused a login, so that a retrying app cannot lock the access; see the README for the return codes after which it logs in once more. An error in the TAN or app approval of a login, such as an expired TAN, is not a refused login, and a login that would lack a required TAN medium is not sent at all.
  • The bank's warnings reach the app through onWarning, apart from those the client acts on itself. New login data (3072) end the dialog and fail the call and all later ones with FinTsLoginDataChangedException, which names them.
  • An error thrown by onBankMessage, onWarning or logger fails the call once its exchange with the bank is over.
  • https only, no redirects, bounded request time, response size and query size; PIN and TANs are masked in the log, along with the sizes that would tell their length, and toString of the models leaves out account data.
  • Follows the parameter data: sends only what the user parameter data and HIPINS permit, takes BIC and complete balance from the account extension of the user parameter data and passes its data status on (Account.dataStatus, with mt940TransactionsId and camtTransactionsId), checks the PIN length before the first message signed with it, and logs in anew after a dialog was idle for longer than the bank's maximum timeout.
  • Parsers for MT940 (German structured :86: fields and SEPA keywords) and camt.052/053; malformed bank data raise FinTsProtocolException instead of being guessed, as does a request for a TAN or an app approval without a challenge, after which the bank has not executed the order.
1
likes
0
points
594
downloads

Publisher

verified publishercoderoftime.dev

Weekly Downloads

FinTS 3.0 and 4.1 client for German banks. Retrieves accounts, balances and transactions with PIN/TAN, two-step TAN, decoupled approval and PSD2 strong customer authentication.

Homepage
Repository (GitLab)
View/report issues

Topics

#fints #hbci #banking #psd2 #finance

License

unknown (license)

Dependencies

clock, collection, http, xml

More

Packages that depend on fints