Important!

Blog moved to https://blog.apdu.fr/

I moved my blog from https://ludovicrousseau.blogspot.com/ to https://blog.apdu.fr/ . Why? I wanted to move away from Blogger (owne...

Saturday, October 16, 2010

MUSCLE mailing list statistics

In my serie about statistics, I generated statistics from the MUSCLE mailing list using the MailListStat software.

I can't easily extract the mails previous to 2005 for technical reasons. 2005 is when I subscribed to the list using my @gmail.com email.

I is interesting to see emails of people in the top 30 that are not present at all in statistics from 2009 or 2010.



Statistics from 3.2.2005 to 15.10.2010



People who have written most messages:

 Author  Msg  Percent 
1ludovic.rousseau@gmail.com97918.16 %
2widerstand@t-online.de4197.77 %
3home_pw@msn.com1582.93 %
4mstjohns@comcast.net791.47 %
5muscle@dseven.org741.37 %
6squalyl@gmail.com741.37 %
7deengert@anl.gov741.37 %
8martin@paljak.pri.ee741.37 %
9pmartin@snakecard.com711.32 %
10aj@dungeon.inka.de681.26 %
11Todd.Denniston@ssa.crane.navy.mil631.17 %
12Michael.Bender@sun.com611.13 %
13shawn-muscle@willden.org591.09 %
14s.ferey@wanadoo.fr581.08 %
15tmiller@mitre.org520.96 %
16corcoran@musclecard.com490.91 %
17alon.barlev@gmail.com470.87 %
18gelgey@vintela.com460.85 %
19ltorro@certisign.com.br430.80 %
20amandaortega@gmail.com420.78 %
21cucinotta@sssup.it420.78 %
22martin.paljak@gmail.com400.74 %
23pwt@iosis.co.uk400.74 %
24mfribeiro@gmail.com380.70 %
25Dejan.Gambin@pula.hr370.69 %
26goister@gmail.com360.67 %
27mistamaila@gmail.com350.65 %
28corcoran@identityalliance.com310.57 %
29countzero@sapo.pt300.56 %
30towergeebulk@gmail.com290.54 %
other244445.33 %

Best authors, by total size of their messages (w/o quoting):

 Author  KBytes 
1ludovic.rousseau@gmail.com607.0
2home_pw@msn.com467.4
3widerstand@t-online.de321.7
4tmiller@mitre.org288.7
5squalyl@gmail.com249.9
6amandaortega@gmail.com197.9
7wnugent@abcsinc.com161.0
8Wei.Hu@quest.com145.4
9towergeebulk@gmail.com144.7
10gelgey@vintela.com134.0
11deengert@anl.gov128.9
12Naveen@worldsmart.com.au128.7
13mfribeiro@gmail.com127.0
14ltorro@certisign.com.br117.4
15Dseven@Dseven.ORG114.4
16daniel@benoy.name108.7
17Michael.Bender@sun.com104.4
18mstjohns@comcast.net101.9
19jackie17youth@yahoo.com92.6
20aj@dungeon.inka.de91.9
21pmartin@snakecard.com90.8
22sguthery@mobile-mind.com89.2
23kammicazze@hotmail.com78.1
24shawn-muscle@willden.org77.7
25ccmartin@ust.hk77.2
26muscle@dseven.org73.9
27s.ferey@wanadoo.fr73.8
28bjohnson@jatdi.mil73.6
29martin@paljak.pri.ee70.3
30Paul.Klissner@sun.com66.2

Best authors, by average size of their message (w/o quoting):

 Author  bytes 
1Dseven@Dseven.ORG29285
2euvieru@gmail.com19127
3wnugent@abcsinc.com16489
4dkeller@pid-llc.com13612
5thomas.harning@identityalliance.com13054
6blargity@gmail.com12414
7forest@alittletooquiet.net11684
8lcstyle@hotmail.com10875
9David.MacKenzie@kirtland.af.mil10813
10y.leplard@dhimyotis.com10693
11marco.matarazzo@manilamatic.it10620
12daniel@benoy.name10117
13mpapet@sci-s.com10088
14benny@benny.de9684
15lfuente@it.uc3m.es9675
16gt-dev@gthomas.homelinux.org9651
17mbrown@dsci.com9452
18Wei.Hu@quest.com9306
19hamish@prodigi.ch8929
20sudheervemana@gmail.com8915
21marcelmancini@hotmail.com8860
22DZShen@Winbond.com.tw8678
23paulaaa1234@hotmail.com8588
24KGUNGL@de.ibm.com8500
25jesus.garcia@worldnet21.com8422
26han.hartgers@gmail.com8211
27rvermer@skynet.be8162
28ccmartin@ust.hk7909
29albertoparis@hotmail.com7763
30Geert.VanMuylem@be.zetes.com7745

Table showing the most successful subjects:

 Subject  Msg  Percent 
1[Muscle] new pcsc-lite and CCID driver: test needed350.65 %
2[Muscle] Cyberflex e-gate 32k install error 6A80320.59 %
3[Muscle] Re: Open readers and iso7816 question310.57 %
4[Muscle] Would like to find ideal err const to return in pcsc-lite290.54 %
5[Muscle] Help with XCardII290.54 %
6[Muscle] muscle getChallenge, versus GP 2 way authentication240.45 %
7[Muscle] NIST Services230.43 %
8[Muscle] Installing MuscleCard on JCOP41 v2.2230.43 %
9[Muscle] Impossible to crypt using MuscleTool230.43 %
10[Muscle] new BETA versions of pcsc-lite and libccid220.41 %
11[Muscle] libmusclecard configure error.210.39 %
12[Muscle] pcsclite-1.2.9beta7 and GemPC430 crash on Fedora 4200.37 %
13[Muscle] SLED10 SCR331200.37 %
14[Muscle] FC6 and pkcs11_inspect200.37 %
15[Muscle] Current state of HAL-support?200.37 %
16[Muscle] pkcslite and libmusclecard on solaris box190.35 %
17[Muscle] CardEdge applet (MCardApplet) version to review190.35 %
18[Muscle] SCLOGON 0.1 Smart Card event daemon for GNU/Linux190.35 %
19[Muscle] Restricting reader/card access by user account190.35 %
20[Muscle] T=0 Case 2 response length190.35 %
21[Muscle] problem installing pycsc180.33 %
22[Muscle] CAC/PKCS11 Help180.33 %
23[Muscle] CAC card and Linux fedora core 5180.33 %
24[Muscle] PS/SC segfault on ACS ACR30U card reader180.33 %
25[Muscle] activcard usb v2.0 firmware upgrade to scr3xx180.33 %
26[Muscle] Problem generating Muscle Card Applet 0.9.11180.33 %
27[Muscle] GlobalPlatform keys180.33 %
28[Muscle] Protecting a PIN with keyed hashing?170.32 %
29[Muscle] 64bit portability and header tidy up170.32 %
30[Muscle] Remote connections to pcsc160.30 %
other474988.07 %

Most used email clients:

 Mailer  Msg  Percent 
1(unknown)241344.75 %
2Mozilla Thunderbird 1.0 (Windows/20041206)3416.32 %
3KMail2534.69 %
4Mozilla/5.x1893.51 %
5Mutt1262.34 %
6QUALCOMM Windows Eudora1092.02 %
7Microsoft Outlook Express 6.x831.54 %
8Microsoft Office Outlook, Build 11.0.6353460.85 %
9Thunderbird 1.5.0.2 (Windows/20060308)420.78 %
10Lotus Notes Release 6.5410.76 %
11Mozilla Thunderbird 1.0.2 (X11/20050322)390.72 %
12Thunderbird 1.5 (X11/20060112)380.70 %
13Apple Mail (2.1077)370.69 %
14Thunderbird 2.0.0.21 (Windows/20090302)330.61 %
15Thunderbird 2.0.0.9 (Windows/20071031)310.57 %
16Microsoft Outlook IMO290.54 %
17Internet Messaging Program (IMP) H3 (5.0-cvs)270.50 %
18Mozilla Thunderbird 0.8 (X11/20040913)260.48 %
19Mozilla Thunderbird 1.0 (X11/20041206)250.46 %
20Apple Mail (2.752.2)240.45 %
21Thunderbird 2.0.0.23 (Windows/20090812)230.43 %
22Apple Mail (2.746.2)210.39 %
23Mozilla Thunderbird 1.0.8-1.1.fc4 (X11/20060501)200.37 %
24Mozilla Thunderbird 0.8 (Windows/20040913)190.35 %
25Thunderbird 1.5.0.5 (X11/20060728)190.35 %
26Coremail Webmail Server Version XT_Ux_snapshot build190.35 %
27Apple Mail (2.728)180.33 %
28Mozilla Thunderbird 1.0.2 (X11/20050602)180.33 %
29Mozilla Thunderbird 1.0.6 (Windows/20050716)180.33 %
30Thunderbird 2.0.0.12 (Windows/20080213)180.33 %
other124723.13 %

Table of maximal quoting:

 Author  Percent 
1guillaume.rablat@c-s.fr90.98 %
2Dejan.Gambin@pula.hr85.56 %
3Hoeben.S@zetes.com82.18 %
4cameron.durham@gte.net80.80 %
5Mahadev.Karadigudda@sun.com78.34 %
6lippold@gmail.com76.65 %
7no.1@online.de76.14 %
8widerstand@t-online.de75.87 %
9simrid@hotmail.com74.84 %
10matheus.oliveira@gmail.com74.22 %
11fschiava@libero.it74.15 %
12lamo@ccs.ru74.04 %
13diego.laborero@macroseguridad.net73.00 %
14christiancatalano@interfree.it72.49 %
15petcoradipewjepknu@jbohm.dk71.99 %
16andre.puschmann@stud.tu-ilmenau.de70.71 %
17esunilkumare@yahoo.co.in70.16 %
18andreas.schwier@cardcontact.de69.88 %
19lxgbrian@yahoo.com.cn68.81 %
20lars@primekey.se68.07 %
21nlarsch@gmx.net67.80 %
22musclecard@fcse.co.uk67.27 %
23cristiano.agosti@gmail.com66.64 %
24dejan.gambin@pula.hr65.55 %
25storm.richard@gmail.com65.31 %
26miro@space-comm.com65.29 %
27acptsys@gmail.com65.14 %
28gold4639@yahoo.com64.77 %
29vskytta@gmail.com63.95 %
30ameetbharti@gmail.com63.71 %
average35.08 %

Graph showing number of messages written during hours of day:

msgs138
|
78
|
59
|
56
|
37
|
38
|
48
|
112
|
296
|
422
|
393
|
434
|
277
|
339
|
383
|
419
|
374
|
287
|
247
|
160
|
173
|
235
|
198
|
189
|
hour 01234567891011121314151617181920212223

Graph showing number of messages written during days of month:

msgs174
|
143
|
172
|
164
|
137
|
153
|
185
|
193
|
163
|
207
|
168
|
131
|
120
|
189
|
213
|
176
|
205
|
145
|
235
|
164
|
196
|
180
|
193
|
176
|
199
|
151
|
198
|
192
|
196
|
178
|
96
|
day 12345678910111213141516171819202122232425262728293031

Graph showing number of messages written during days of week:

msgs857
|
1022
|
1035
|
967
|
831
|
330
|
337
|

MonTueWedThuFriSatSun

Warning: 13 message(s) not counted.


Maximal quoting:

Author : widerstand@t-online.de
Subject : [Muscle] Installing MuscleCard on JCOP41 v2.2
Date : Mon, 10 Apr 2006 20:29:22 +0200
Quote ratio: 99.29% / 33835 bytes

Longest message:

Author : Dseven@Dseven.ORG
Subject : visibility problems (Re: [Muscle] New pcsc-lite 1.2.9-beta10
Date : Wed, 15 Mar 2006 16:23:35 -0800
Size : 113891 bytes

Most successful subject:

Subject : [Muscle] new pcsc-lite and CCID driver: test needed
No. of msgs: 35
Total size : 40711 bytes

Final summary:

Total number of messages: 5392
Total number of different authors: 643
Total number of different subjects: 1776
Total size of messages (w/o headers): 15999403 bytes
Average size of a message: 2967 bytes


Input file last updated: Sat Oct 16 14:23:39 2010Generated by MailListStat v1.3


Flattr this

Friday, October 15, 2010

IFDHandler version 1 support removed from pcsc-lite

In revision 5321 (October 2010) I removed the support of the IFD Handler API version 1. The IFD Handler API the is API used to communicate between pcscd and reader driver. The API v3 is documented here.

The version 1 of the API is very old and I never saw a reader driver using it. Even when I started using pcsc-lite and writing drivers the version 2 was already in place.

Motivation


I removed this API for two reasons:
  1. This API is not used and is dead code inside pcscd.
  2. This API do not return the ATR on card power on but using IFD_Set_Capabilities()/IFD_Get_Capabilities() and IFDStatusICC() had a special case for that.

With this v1 API removal I can simplify the prototype of IFDStatusICC() and remove 2 parameters from:

LONG IFDStatusICC(READER_CONTEXT * rContext, PDWORD pdwStatus,
PUCHAR pucAtr, PDWORD pdwAtrLen)

to:

LONG IFDStatusICC(READER_CONTEXT * rContext, PDWORD pdwStatus)


This also simplifies the internal pcscd code using IFDStatusICC() since the code just wants to know if a card is present or not, but not need to know the ATR.

Consideration


Note that I already removed the API prototype from ifdhandler.h in revision 4472 in October 2009. And no one complained since then. So the version 1 API may really be unused.

Result


51 lines of code added. 335 lines of code removed. Gain: 284 lines of code removed.


Flattr this

Friday, October 8, 2010

Subversion statistics for CCID driver (libccid) at September 2010

I used the tool statsvn to generate nice graphics about the subversion activity of the CCID driver (libccid) project.

The full report is available here. We will just reuse some graphics and discuss them.

Developers


The project is now 7 years old. I am the only developer on the project. It is a one man project. This can be problematic because the bus factor is quite low.

Source code


The total number of line of "code" is still growing at a constant rate.



With a closer look it appears that not every thing is source code. A large part of the content comes from the readers/ directory.

The readers/ contains the CCID description (the reader capabilities) of CCID readers. The data is also available in the big matrix.



The readers/ directory is the biggest part of the repository.



In the src/ directory the file sizes are visible using the repomap tool. You will get display like this:



Conclusion


It always nice to stand back and look at a big picture on a project you are involved.

You can also have different graphics from the libccid project at ohloh.net site.

For example ohloh.net estimates the cost of the project at 2 man.year for a total of 89,000 US$. The 2 man.year estimation is very reasonable. Over the 7 years of the project that is an average of one or two days per week.


Flattr this

Thursday, October 7, 2010

Subversion statistics for pcsc-lite at September 2010

I used the tool statsvn to generate nice graphics about the subversion activity of the pcsc-lite project.

The full report is available here. We will just reuse some graphics and discuss them.

Developers


The project is now 10 years old. The old versions were hosted in a CVS repository on David Corcoran computer. The access was slow. In 2003 the project moved to the Debian forge at https://alioth.debian.org/projects/pcsclite/.

9 developpers committed patches to the project.

Author Author Id Changes Lines of Code Lines per Change
Totals 3897 (100.0%) 155334 (100.0%) 39.8
rousseau rousseau 3183 (81.7%) 86878 (55.9%) 27.2
corcoran corcoran 339 (8.7%) 63138 (40.6%) 186.2
aet-guest aet-guest 227 (5.8%) 2696 (1.7%) 11.8
sauveron-guest sauveron-guest 110 (2.8%) 1918 (1.2%) 17.4
corcoran-guest corcoran-guest 25 (0.6%) 528 (0.3%) 21.1
cprados cprados 4 (0.1%) 91 (0.1%) 22.7
giraud giraud 7 (0.2%) 83 (0.1%) 11.8
phuang phuang 1 (0.0%) 1 (0.0%) 1.0
mikeg mikeg 1 (0.0%) 1 (0.0%) 1.0

A large part of the code was written by David Corcoran. Even if David has not committed any thing since 2004 he is the author of 40% of lines of code.



Since 2004 I am the only one to commit changes in the subversion repository. I receive some patches from other people but they do not have write access to the subversion repository so the commits appear as mine.

Source code




The number of lines in the project is slowly growing. The main features are present since the beginning. What I do is mainly debug and optimization.



As expected a large part of the "code" is located in the src/ directory.

You can use a live source code explorer at repomap to display things like:


Conclusion


It always nice to stand back and look at a big picture on a project you are involved.

You can also have different graphics from the pcsc-lite project at ohloh.net site.


Flattr this

Saturday, September 4, 2010

pcscd auto start

The problem


pcsc-lite is composed of two parts:
  1. a daemon pcscd
  2. The daemon job is to access/send commands to the readers, through reader drivers.
  3. a library libpcsclite.so.1
  4. The library provides the PC/SC API to the application to talk to the pcscd daemon using an internal protocol.

Traditionally the daemon is started when the system starts and is running until the system is shut down.

Using the dependencies relation of packages in modern distributions you may install a package that, in some cases, uses PC/SC and then is linked with libpcsclite and then pcscd is also installed and running all the time for nothing.

The solution


The idea is to start pcscd only when needed. It is possible since the first PC/SC call is always SCardEstablishContext(). So SCardEstablishContext() must check if pcscd is already running and launch it if not.

The implementation details


pcscd exit


It is also possible to exit pcscd when no more client is using it. This is possible since the last PC/SC call is always SCardReleaseContext().

When all the contexts open with SCardEstablishContext() have been closed by SCardReleaseContext() it is possible to exit pcscd. To avoid restarting pcscd just after exiting it, pcscd exits only after 60 seconds of inactivity. It is configurable using:
#define TIME_BEFORE_SUICIDE 60

Reader devices access rights


By default (on GNU/Linux) USB devices are accessible (for write accesses) by root processes only. If pcscd is started during the system start up the process is executed as root so has the correct permissions to access the USB devices. But if now pcscd is started by a process of a normal user it will be started with the access rights of this normal user.

pcscd then needs to gain extra access rights. This is the perfect use of the suid/sgid mechanism. In pcsc-lite 1.6.x (with x < 5) the file /usr/sbin/pcscd was suid root. So the process was running as root. It does work but programs running as root are always "suspicious" for a security aware administrator. And it is even more important if the program is suid root, as it was the case.

To be conform to the principle of least privilege a better approach has been implemented. The access rights of the devices are changed to be accessible in read and write to a process in the group "pcscd", and pcscd is now a sgid program in the group "pcscd". So when pcscd is started by a normal user it will gain access to files in the group "pcscd".

The group "pcscd" should be used only by pcsc-lite so only pcscd has access to smart card readers. The pcscd process has only gained the minimum rights needed to do its job (instead of gaining root access).

udev rule


To change the access rights of a USB devices the solution on a GNU/Linux system is to write a udev rule file.

The CCID driver provides such a udev rule file.

The main part of the file is:
# If not adding the device, go away
ACTION!="add", GOTO="pcscd_ccid_rules_end"
SUBSYSTEM!="usb", GOTO="pcscd_ccid_rules_end"
ENV{DEVTYPE}!="usb_device", GOTO="pcscd_ccid_rules_end"

# generic CCID device
ATTRS{bInterfaceClass}=="0b", RUN+="/bin/chgrp pcscd $root/$parent"

# All done
LABEL="pcscd_ccid_rules_end"

If a device has an interface with the field bInterfaceClass set to 0x0b (11 in decimal) then it is a CCID device according to the CCID specification. In that case run the command chgrp to set the group to pcscd to the parent device.

udev has a GROUP= action to change the group of a device but it looks like I can't use that. The rule matches a field of an interface but GROUP= works when matching a device (the parent of an interface).

Reader driver impacts


The reader drivers have to provide a udev rule to change the group ownership of the device supported by the driver. If they do not the devices will not be accessible unless pcscd is run as root (as before).

For example the ifd-gempc driver will have to provide a udev rule for the 3 USB devices supported.

Something like:
# udev rules to set the access rights of GemPC smart card readers
# so they can be used by pcscd

# If not adding the device, go away
ACTION!="add", GOTO="pcscd_ifd_gempc_rules_end"
SUBSYSTEM!="usb", GOTO="pcscd_ifd_gempc_rules_end"

# GemPC 430, 432 & 435 USB readers
ATTRS{idVendor}=="08e6", ATTRS{idProduct}=="0430", GROUP="pcscd"
ATTRS{idVendor}=="08e6", ATTRS{idProduct}=="0432", GROUP="pcscd"
ATTRS{idVendor}=="08e6", ATTRS{idProduct}=="0435", GROUP="pcscd"

# All done
LABEL="pcscd_ifd_gempc_rules_end"

The file is easy to generate since you just have to reuse the information from the Info.plist file of the driver.

The rule file for the CCID driver is a bit different since I used the fact that CCID devices all have the same USB class (bInterfaceClass).

Security aspects


Possible security vulnerability in pcscd


I know no security vulnerability in pcscd. But pcscd is not immune. See pcsc-lite security advisory CVE-2010-0407 for example.

If a new security vulnerability in pcscd is found the impact will be much lower now that pcscd run as a simple user in group "pcscd". An attacker would not gain root access.

Multi user systems


What will happen on a system with users A and B that both want to use PC/SC?

Suppose A starts a PC/SC program and then starts the pcscd daemon. pcscd will run as user A with the group set to pcscd.

Then B starts a PC/SC program. pcscd is already running so it will not be restarted.

B could try to inject code in the pcscd process and run the code with the access rights of A. This should not be possible. See the previous chapter about possible vulnerability in pcscd.

User A could run pcscd in debug mode (using the --debug and --apdu option of pcscd) and see all the PC/SC commands and APDU used by the application run by B. Such APDU could contain the pincode of B for example. This attack is not possible. pcscd contains a check to disable the --apdu option if it has been launched using the sgid mechanism.

Conclusion


The auto start mechanism introduced in pcsc-lite 1.6.0 allows to limit the number of running processes (when a smart card is not used).

The sgid mechanism introduced in pcsc-lite 1.6.5 greatly limits the security implication by just using a special group instead of running pcscd as root.